-
MySQL / MariaDB
bigint binary bit blob bool boolean char date datetime dec decimal double enum fixed float geometry geometrycollection int integer json linestring longblob longtext mediumblob mediumint mediumtext multilinestring multipoint multipolygon numeric point polygon real set smallint text time timestamp tinyblob tinyint tinytext varbinary varchar year
-
MSSQL
bigint binary bit char date datetime datetime2 datetimeoffset decimal float geography geometry image int money nchar ntext numeric nvarchar real smalldatetime smallint smallmoney sql_variant text time tinyint uniqueidentifier varbinary varchar xml
-
Oracle
bfile binary_double binary_float blob char clob date datetime long nchar nclob number nvarchar2 raw timestamp uritype varchar varchar2 xmltype
-
PostgreSQL
bigint bigserial bit bool boolean box bytea char character cidr circle date decimal float4 float8 inet int int2 int4 int8 integer interval json jsonb line lseg macaddr macaddr8 money numeric path pg_lsn point polygon real serial serial2 serial4 serial8 smallint smallserial text time timestamp timestamptz timetz tsquery tsvector txid_snapshot uuid varbit varchar xml
-
SQLite
blob integer numeric real text
CREATE TABLE a (
b bigint
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "bigint",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
}
]
}
CREATE TABLE "a" (
"b" bigint
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "bigint",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
}
]
}
CREATE TABLE 'a' (
'b' bigint
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "bigint",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
}
]
}
CREATE TABLE `a` (
`b` bigint
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "bigint",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
}
]
}
CREATE TABLE test.a (
b bigint
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "bigint",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
}
]
}
CREATE TABLE a (
b varchar(255) NOT NULL DEFAULT 'c' COMMENT 'd' PRIMARY KEY AUTO_INCREMENT UNIQUE
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "varchar(255)",
"default": "c",
"comment": "d",
"primaryKey": true,
"autoIncrement": true,
"unique": true,
"nullable": false
}
],
"indexes": [],
"foreignKeys": []
}
]
}
CREATE TABLE a (
b varchar(255),
c int,
PRIMARY KEY(b, c)
)
CREATE TABLE b (
b varchar(255),
c int,
CONSTRAINT PK_B PRIMARY KEY(b, c)
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "varchar(255)",
"default": "",
"comment": "",
"primaryKey": true,
"autoIncrement": false,
"unique": false,
"nullable": true
},
{
"name": "c",
"dataType": "int",
"default": "",
"comment": "",
"primaryKey": true,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
},
{
"type": "create.table",
"name": "b",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "varchar(255)",
"default": "",
"comment": "",
"primaryKey": true,
"autoIncrement": false,
"unique": false,
"nullable": true
},
{
"name": "c",
"dataType": "int",
"default": "",
"comment": "",
"primaryKey": true,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
}
]
}
CREATE TABLE a (
b varchar(255),
c int,
UNIQUE(b, c)
)
CREATE TABLE b (
b varchar(255),
c int,
CONSTRAINT UC_B UNIQUE(b, c)
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "varchar(255)",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": true,
"nullable": true
},
{
"name": "c",
"dataType": "int",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": true,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
},
{
"type": "create.table",
"name": "b",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "varchar(255)",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": true,
"nullable": true
},
{
"name": "c",
"dataType": "int",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": true,
"nullable": true
}
],
"indexes": [],
"foreignKeys": []
}
]
}
CREATE TABLE a (
b varchar(255),
c int,
INDEX IDX_A (b DESC, c ASC)
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "varchar(255)",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
},
{
"name": "c",
"dataType": "int",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [
{
"name": "IDX_A",
"unique": false,
"columns": [
{
"name": "b",
"sort": "DESC"
},
{
"name": "c",
"sort": "ASC"
}
]
}
],
"foreignKeys": []
}
]
}
CREATE TABLE a (
b varchar(255),
c int,
FOREIGN KEY(b, c) REFERENCES b (b, c)
)
CREATE TABLE b (
b varchar(255),
c int,
CONSTRAINT FK_B FOREIGN KEY(b, c) REFERENCES a (b, c)
)
{
"statements": [
{
"type": "create.table",
"name": "a",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "varchar(255)",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
},
{
"name": "c",
"dataType": "int",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": [
{
"columnNames": ["b", "c"],
"refTableName": "b",
"refColumnNames": ["b", "c"]
}
]
},
{
"type": "create.table",
"name": "b",
"comment": "",
"columns": [
{
"name": "b",
"dataType": "varchar(255)",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
},
{
"name": "c",
"dataType": "int",
"default": "",
"comment": "",
"primaryKey": false,
"autoIncrement": false,
"unique": false,
"nullable": true
}
],
"indexes": [],
"foreignKeys": [
{
"columnNames": ["b", "c"],
"refTableName": "a",
"refColumnNames": ["b", "c"]
}
]
}
]
}
CREATE INDEX IDX_A on A (a, b DESC)
CREATE UNIQUE INDEX IDX_B on B (a, b DESC)
{
"statements": [
{
"type": "create.index",
"name": "IDX_A",
"unique": false,
"tableName": "A",
"columns": [
{
"name": "a",
"sort": "ASC"
},
{
"name": "b",
"sort": "DESC"
}
]
},
{
"type": "create.index",
"name": "IDX_B",
"unique": true,
"tableName": "B",
"columns": [
{
"name": "a",
"sort": "ASC"
},
{
"name": "b",
"sort": "DESC"
}
]
}
]
}
ALTER TABLE Persons ADD PRIMARY KEY (ID)
ALTER TABLE Persons ADD CONSTRAINT PK_Person PRIMARY KEY (ID,LastName)
{
"statements": [
{
"type": "alter.table.add.primaryKey",
"name": "Persons",
"columnNames": ["ID"]
},
{
"type": "alter.table.add.primaryKey",
"name": "Persons",
"columnNames": ["ID", "LastName"]
}
]
}
ALTER TABLE Orders
ADD FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
ALTER TABLE Orders
ADD CONSTRAINT FK_PersonOrder
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
{
"statements": [
{
"type": "alter.table.add.foreignKey",
"name": "Orders",
"columnNames": ["PersonID"],
"refTableName": "Persons",
"refColumnNames": ["PersonID"]
},
{
"type": "alter.table.add.foreignKey",
"name": "Orders",
"columnNames": ["PersonID"],
"refTableName": "Persons",
"refColumnNames": ["PersonID"]
}
]
}
ALTER TABLE Persons ADD UNIQUE (ID)
ALTER TABLE Persons ADD CONSTRAINT UC_Person UNIQUE (ID,LastName)
{
"statements": [
{
"type": "alter.table.add.unique",
"name": "Persons",
"columnNames": ["ID"]
},
{
"type": "alter.table.add.unique",
"name": "Persons",
"columnNames": ["ID", "LastName"]
}
]
}