The table creation command requires
The generic table creation syntax is CREATE TABLE table_name (column_name column_type); The table name is up to you of course, but should be a name that reflects the usage of the table. For example, if you have a table that holds the inventory of a grocery store, you wouldn't name the table s. You would probably name it something like grocery_inventory. Similarly, the field names you select should be as concise as possible and relevant to the function they serve and data they hold. For example, you might call a field holding the name of an item item_name, not n. This example creates a generic grocery_inventory table with fields for ID, name, description, price, and quantity: mysql> CREATE TABLE grocery_inventory ( -> id int not null primary key auto_increment, -> item_name varchar (50) not null, -> item_desc text, -> item_price float not null, -> curr_qty int not null -> ); Query OK, 0 rows affected (0.02 sec)
The MySQL server will respond with Query OK each time a query, regardless of type, is successful. Otherwise, an error message will be displayed. |