To hand-code a table, or create a bunch of tables in a script, use this:
CREATE TABLE `tablename`( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` varchar(255) NOT NULL )
You may note the “backticks” which are the little symbol on the same key as the tilde “~”, and are used to note the tablename and fieldnames.
INT(11) tells the database that this is an integer no longer than 11, makes sense, right? “NOT NULL” means nulls are not allowed. “AUTO_INCREMENT” means this is the id field that will automatically add one to itself every time you create a record. Lastly “PRIMARY KEY” tells us that this will be the field the database tries to keep in order via indexing.
You can add as many fields as you want, of different types, as you can see with the name field shown above. For a more complete reference on creating tables, visit the MySQL Create Table page (version 5.1, pretty common, but not everywhere yet).
