May 2003
Intermediate to advanced
592 pages
14h 28m
English
The first logical use of SQL and MySQL will be to create a database. The syntax for creating a new database is
CREATE DATABASE databasename;
The CREATE term is also used for making tables.
CREATE TABLE tablename (column1name description, column2name description ...);
As you can see from the syntax above, after naming the table, you define each column—in order—within parentheses. Each column and description should be separated by a comma. Should you choose to create indexes at this time (see the sidebar, Indexes and Keys), you can add those at the end of the creation statement, but you can add indexes at a later time as well.
1. | Access the mysql monitor.
mysql -u username -p ... |
Read now
Unlock full access