SQLizer can read a variety of files and convert them into SQL scripts that import the data into a database. From data in those files it can generate the necessary SQL code for storing data in a MySQL, Microsoft SQL Server or PostgreSQL database. SQLizer can read the following types of file:
Once the data file is uploaded SQLizer analyzes the contents of the file and works out what kind of database table can hold all the data.
Database tables need to know which type of data they hold - such as text, numbers, or dates. But many data files do not explicitly state which type of data they contain. This makes importing data into a database difficult because you need to work the tables out for yourself, which can take hours.
Let's say you want to convert CSV to SQL. The content of the CSV file looks like this:
Column 1,Column 2,Column 3, Column_4
Hello World, 12345, 01/01/2014, 56.78
SQLizer detects that Column_1 contains text, Column_2 contains only whole numbers, Column_3 contains a date, and Column_4 contains a decimal number. The resulting SQL database INSERT script looks like this:
CREATE TABLE IF NOT EXISTS example (
`Column_1` VARCHAR(11) CHARACTER SET utf8,
`Column_2` INT,
`Column_3` DATETIME,
`Column_4` NUMERIC(4, 2)
);
INSERT INTO example VALUES
('Hello World', 12345,'2014-01-01 00:00:00', 56.78);
IF NOT EXISTS (
select * from sysobjects where name='example' and xtype='U'
) CREATE TABLE example (
[Column_1] NVARCHAR(11),
[Column_2] INT,
[Column_3] DATETIME,
[Column_4] NUMERIC(4, 2)
);
INSERT INTO example VALUES
(N'Hello World', 12345,'2014-01-01 00:00:00', 56.78);
CREATE TABLE IF NOT EXISTS "example" (
"Column_1" TEXT,
"Column_2" INT,
"Column_3" TIMESTAMP,
"Column_4" NUMERIC(4, 2)
);
INSERT INTO "example" VALUES
('Hello World', 12345,'2014-01-01 00:00:00', 56.78);
CREATE TABLE IF NOT EXISTS example (
Column_1 TEXT,
Column_2 INTEGER,
Column_3 TEXT,
Column_4 NUMERIC
);
INSERT INTO example VALUES
('Hello World', 12345,'2014-01-01 00:00:00', 56.78);
You'll see that SQLizer automatically detected the maximum length of Column_1 as 11 characters and the maximum size and precision of numbers in Column_4 as 4 digits and 2 decimal places.
For more information see the help pages on how SQLizer handles different file types such as CSV and text files, spreadsheets, JSON and XML files. Or the pages on number handling, date handling and text handling.