CREATE [TEMPORARY] TABLE[IF NOT EXISTS] table_name[(create_definition,...)][table_options] [select_statement]
Description: Creates a table called table_name. The table name can be specified as database_name.table_name to create a table in a database not currently selected.
TEMPORARY option creates a table that will be dropped automatically when the database connection closes (version 3.23 and later).
IF NOT EXISTS option suppresses the error that will be returned if you try to create a table when another table with that name currently exists (version 3.23 and later).
The create_definition for each column can contain the following for defining a column:
column_name column_type [NOT NULL|NULL] [DEFAULT default_value] [AUTO_INCREMENT] [PRIMARY KEY] ...
Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.