Standard

SQL CREATE TABLE Generator

Add columns, pick types and constraints, and get a ready CREATE TABLE statement.

Advertisement

About this tool

Choose your database first, then describe each column with a general type. The generator writes the right type name for that database: DATETIME becomes TIMESTAMP in PostgreSQL and DATETIME2 in SQL Server, BOOLEAN becomes BIT in SQL Server, and UUID uses the native type where there is one. Tick Auto-inc on an integer key to get the database's own auto-numbering syntax (AUTO_INCREMENT, GENERATED BY DEFAULT AS IDENTITY, IDENTITY(1,1) or SQLite's INTEGER PRIMARY KEY AUTOINCREMENT).

Tick PK on more than one column for a composite primary key. Names that contain spaces or clash with a reserved word, such as order or user, are quoted in the database's own style. Notes appear under the result when a choice doesn't carry over, such as SQLite storing dates as text.