SQL Table Generator

Build CREATE TABLE statements visually for five databases.

ColumnTypeLengthPKNNUQAIDefault

SQL Table Generator Online

The SQL table generator is a visual builder for CREATE TABLE statements. Instead of remembering the exact syntax for identity columns in SQL Server or the right string type in Oracle, you describe the columns in a small grid and the tool writes correct DDL for the database you pick. The statement updates live as you edit, ready to copy into a migration or run in a console.

Building a table

Enter a table name, then add one row per column. For each column you choose:

  • Name and type – portable types such as int, bigint, decimal, varchar, text, boolean, date, timestamp, uuid, json, and blob.
  • Length / precision – e.g. 255 for varchar or 10,2 for decimal.
  • Flags – primary key (PK), not null (NN), unique (UQ), and auto increment (AI).
  • Default – a literal value or an expression like CURRENT_TIMESTAMP.

Composite primary keys are supported: mark several columns as PK and a table-level PRIMARY KEY (…) constraint is generated.

One design, five dialects

Portable types are mapped to each engine's native types — boolean becomes TINYINT(1) in MySQL, BIT in SQL Server, and NUMBER(1) in Oracle; uuid becomes PostgreSQL's native UUID, UNIQUEIDENTIFIER in SQL Server, RAW(16) in Oracle, and CHAR(36) in MySQL. Identifiers are quoted the way each database expects: backticks, double quotes, or square brackets. The Only if it doesn't exist option adds IF NOT EXISTS where the dialect supports it (SQL Server gets an OBJECT_ID guard instead), and MySQL output includes an InnoDB engine and utf8mb4 character set clause.

Typical workflow

Sketch a table here, paste it into your migration file, and then generate matching queries with the SQL Code Generator, which reads a CREATE TABLE and writes parameterised SELECT, INSERT, UPDATE, and DELETE statements.

Have data in a spreadsheet? CSV to SQL infers column types and generates both the table and the INSERTs. Format existing scripts with the SQL Viewer, and escape string values with SQL Escape.

Frequently Asked Questions

MySQL/MariaDB, PostgreSQL, SQLite, SQL Server, and Oracle. Switching the Database dropdown rewrites the statement with that dialect's identifier quoting, data type names, and auto-increment syntax.

MySQL uses AUTO_INCREMENT, PostgreSQL uses the SERIAL type, SQL Server uses IDENTITY(1,1), Oracle uses GENERATED BY DEFAULT AS IDENTITY, and SQLite relies on INTEGER PRIMARY KEY AUTOINCREMENT.

Yes. Type the default into the column's Default field. Numbers, TRUE/FALSE, NULL, and functions such as CURRENT_TIMESTAMP are written as-is; any other text is written as a quoted string literal.

No. It only generates the CREATE TABLE statement. Copy it or download the .sql file and run it in your database client or migration tool.