CreateTable demo

← List all

← Parse another

Parsing "CREATE TABLE inventory\r\n(\r\n..."

Input

Original

CREATE TABLE inventory
(
   id INT IDENTITY(1,1) PRIMARY KEY,
   product VARCHAR(50) UNIQUE,
   quantity INT,
   price DECIMAL(18,2)
);

Results

  1. Table structure
  2. Cross-platform SQL
  3. Errata

CreateTable is still young—please comment on any errors or surprises in the Errata section! Thank you.

Table structure

Number of columns: 4

name data_type allow_null default primary_key unique autoincrement charset collate
id INTEGER false true true true
product CHARACTER VARYING(50) true false true false
quantity INTEGER true false false false
price DECIMAL(18,2) true false false false

Cross-platform SQL

MySQL
CREATE TABLE inventory ( `id` INTEGER PRIMARY KEY AUTO_INCREMENT, product CHARACTER VARYING(50) UNIQUE, quantity INTEGER, price DECIMAL(18,2) )
PostgreSQL
CREATE TABLE inventory ( "id" SERIAL PRIMARY KEY, product CHARACTER VARYING(50) UNIQUE, quantity INTEGER, price DECIMAL(18,2) )
Sqlite3
CREATE TABLE inventory ( "id" INTEGER PRIMARY KEY AUTOINCREMENT, product CHARACTER VARYING(50) UNIQUE, quantity INTEGER, price DECIMAL(18,2) )

Errata

comments powered by Disqus

© 2017 Brighter Planet, Inc.