CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table (create_clause, ...) [table_options] [[IGNORE|REPLACE] select]
CREATE TABLE statement defines the structure
of a table within the database. This statement is how all MySQL
tables are created. If the
TEMPORARY keyword is
used, the table exists only as long as the current client connection
exists, or until you explicitly drop the table.
EXISTS clause tells MySQL to create the table only
if the table does not already exist. If the table does exist, nothing
happens. If the table exists and
TEMPORARY are not specified, an error will occur.
TEMPORARY is specified and the table exists but
EXISTS is not specified, the existing table will
simply be invisible to this client for the duration of the new
temporary table's life.
CREATE clause can either define the structure
of a specific column or define a meta-structure for the column. A
CREATE clause that defines a column consists of
the name of the new table followed by any number of field
definitions. The syntax of a field definition is:
column type[NOT NULL | NULL] [DEFAULT
value] [AUTO_INCREMENT] [PRIMARY KEY] [
MySQL supports the data types described in Chapter 16. The modifiers in this syntax are:
Indicates that the column should be automatically incremented using the current greatest value for that column. Only whole number columns may be auto-incremented.
This attribute ...