The create statement is used to create new tables in the database.
create table tablename ( column coltype options, column coltype options, ... primary key (colname) )
Data types include (but are not limited to):
Table 2-8. Some data types
INT | an integer number |
FLOAT | a floating point number |
CHAR(n) | character data of exactly n characters |
VARCHAR(n) | character data of up to n characters (field grows/shrinks to fit) |
BLOB | Binary Large OBject |
DATE | A date in YYYY-MM-DD format |
ENUM | enumerated string value (eg "Male" or "Female") |
Data types vary slightly between different database systems. The full range of MySQL data types is outlined in section 7.2 of the MySQL reference manual.
create table contactlist ( id int not null auto_increment, name varchar(30), phone varchar(30), primary key (id) )