Columns input
Generated SQL
How to use
Input format: one column per line using comma (or tab) separated fields:
name,type,constraints,default
Constraints can include tokens like: pk, ai, notnull, unique. Put defaults in the 4th field (raw SQL, e.g. CURRENT_TIMESTAMP or 'text').
- Choose a SQL dialect and enter a table name (optional schema).
- Paste columns into the input box (one per line).
- Click Generate SQL, then copy or download.
FAQ
What input format does this CREATE TABLE generator accept?
Use one column per line: name,type,constraints,default (comma- or tab-separated). Constraints are simple tokens like pk, ai, notnull, unique.
How do I set a default value?
Put it in the 4th field as raw SQL, e.g. CURRENT_TIMESTAMP or 'active'. SQL Server defaults are wrapped as DEFAULT (...).
How is auto-increment handled across databases?
MySQL uses AUTO_INCREMENT, PostgreSQL uses GENERATED BY DEFAULT AS IDENTITY, SQL Server uses IDENTITY(1,1), and SQLite uses inline INTEGER PRIMARY KEY AUTOINCREMENT when applicable.
Can it generate composite primary keys?
Yes. Mark multiple columns with pk and the tool emits a table-level PRIMARY KEY (col1, col2).
What does “safe create / IF NOT EXISTS” do?
It avoids errors when the table already exists. SQL Server uses an IF OBJECT_ID(...) IS NULL wrapper; other dialects use CREATE TABLE IF NOT EXISTS.
Does this tool validate my SQL types?
No—types are used as you enter them. If you want checks for common mistakes, use the linked SQL Checker tool.
Is this tool client-side and private?
Yes. It runs in your browser and doesn’t send your input over the network.