1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
CREATE TABLE
============
A CREATE statement in SQL creates an object inside of Drizzle. One of the most common CREATE command is the CREATE TABLE command.
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table_name
(create_definition, ...)
[engine_options]
or:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table_name
[(create_definition, ...)]
[engine_options]
select_statement
or:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table_name
LIKE different_table_name
[engine_options]
create_definition:
column_name column_definition
| [CONSTRAINT [symbol] ] PRIMARY KEY [index_type]
(index_column_name, ...)
| INDEX [index_name] (index_column_name, ...)
(index_column_name, ...)
| [CONSTRAINT [symbol] ] UNIQUE [INDEX]
(index_column_name, ...)
| [CONSTRAINT [symbol] ] FOREIGN KEY [index_name] (index_column_name, ...)
reference_definition
| CHECK (expr)
column_definition:
data_type [NOT NULL | NULL] [DEFAULT default_value]
[AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY]
[COMMENT 'string']
[reference_definition]
data_type:
| INTEGER
| BIGINT
| DOUBLE[(length, decimals)]
| DECIMAL[(length[,decimals])]
| DATE
| TIMESTAMP
| DATETIME
| VARCHAR(length) [COLLATE collation_name]
| VARBINARY(length)
| BLOB
| TEXT [BINARY] [COLLATE collation_name]
| ENUM(value1, value2, value3, ...) [COLLATE collation_name]
reference_option:
RESTRICT | CASCADE | SET NULL | NO ACTION
engine_options:
engine_option [[,] engine_option] ...
engine_option:
ENGINE = engine_name
{ engine_specific }
|