View Full Version : How do I create a new table in mySQL?
wjstev0
10-26-02, 11:28 PM
:confused: Wow my head hurts. I admit I hate relational databases and have a mental block.
Can anyone tell me how to create a new table? Please use the KISS method when explaining it.
Also, is there a resource for a lay person to learn more about mySQL. One of those with lots of pictures.
Thanks in advance
Bill:confused:
RSaucier
10-27-02, 12:26 AM
Most simple syntax:
CREATE TABLE IF NOT EXISTS table_name (column_name column_type[(column_length)], column_name column_type[(column_length)], <more columns as necessary>)
Stuff in lower case needs to be created by you. Column types can be any of 27 different types, some requiring a length or not if the default fulfills your need.
There are also a variety of other specifiers you can add to make life easier down the road, auto increment for example.
There are quite a few books on SQL in general and MySQL in particular. Check in your local larger bookstore for PHP and MySQL for Dummies (ISBN: 0764516507, published June, 2002) or a similar book. I also recommend PHP and MySQL Web Development (ISBN: 0672317842, pub 03/2001).
Amazon has a deal on both as a package for $52.48, about US$22.00 cheaper than retail price (free shipping too!). Here's the link (http://www.amazon.com/exec/obidos/tg/detail/-/0764516507/qid=1035688967/sr=8-1/ref=sr_8_1/104-6360652-4592745?v=glance&n=507846) (and it's not even a referrer link!)
Hope this helps!
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.