Creating a Table in MySQL can be a little daunting, especially if you’re used to the GUI interfaces of other databases. (SQL, Access). But it’s not that hard.
Once you’re in MySQL, and in your database, simply use the CREATE TABLE statement to specify the layout of your table.
mysql> CREATE TABLE tony (name VARCHAR(20), when DATE, why CHAR(1));
What you’ve done is specify the table and columns, and column types. VARCHAR is a good generic choice when you’ve got text columns that will vary in length. Any length from 1 to 255 will work. (if you need to alter your choice later, MySQL provides an ALTER TABLE
The MySQL Site has a good listing of the MySQL Column Types to help you define those columns.
Tagged As MySQL
Comments are Open (0)
Posted at 12:00 PM