Figure 6.1 Starting MySQL with an active database.
From the blueprint that was developed on Day 3, "Designing Your First Database," you will create the
Customers table. To do this, enter the following commands exactly as they appear. Remember that
pressing the Enter key does not execute the command unless the command ends with a semicolon or a
\g.
CREATE TABLE Customers (Customer_ID INT NOT NULL
PRIMARY KEY AUTO_INCREMENT, First_Name VARCHAR(20)
NOT NULL, Last_Name VARCHAR(30) NOT NULL,
Address VARCHAR(50), City VARCHAR(20),
State VARCHAR(2), Zip VARCHAR(20),
E_Mail VARCHAR(20), Age INT, Race VARCHAR(20),
Gender ENUM('M', 'F') DEFAULT 'F',
Eye_Color VARCHAR(10), Hair_Color VARCHAR(10),
Favorite_Activity ENUM('Programming', 'Eating',
'Biking', 'Running', 'None') DEFAULT 'None',
Favorite_Movie VARCHAR(50),Occupation VARCHAR(30)
, Smoker CHAR(0));
Your output should like Figure 6.2.
Figure 6.2 Creating a new table for the Meet_A_Geek database.
- To verify your actions, type the following:
- SHOW TABLES FROM Meet_A_GEEK;