Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
NULL

Email VARCHAR
(30), Not
NULL

Age INTEGER^

Gender
Male,
Female, Unk

Race

VARCHAR(10)

Eye_Color

VARCHAR(15)

Hair_Color

VARCHAR(15)

Fav_Activity

VARCHAR(30)

Fav_Movie VARCHAR(30)^

Occupation

VARCHAR(50)

Smoker
Yes, No, Unk

Table 21.2 The Ads Table


Characteristic Data Type

Ad_Text
TEXT, Not
NULL

Date_Posted

DATETIME,

Not NULL

Table 21.3 The Products Table


Characteristic Data Type

Name

VARCHAR(30),

Not NULL

Description

VARCHAR(255),

Not NULL

Price FLOAT(10,2),
Not NULL

Manufacturer

VARCHAR(50),

Not NULL

Picture

VARCHAR(50),

Not NULL

Table 21.4 The Orders Table


Characteristic Data Type

Order_Date DATETIME,
Not NULL

Quantity
INTEGER, Not
NULL

Product

VARCHAR(30),

Not NULL

Customer VARCHAR(30),
Not NULL

Amount_Due

FLOAT(10,2),

NOT NULL

Payment_Received
Yes or No

Now that the objects are described and the business rules have been established, it's time to turn your
objects into tables by adding a key to each table and performing some normalization.
Free download pdf