First page Back Continue Last page Image

For The CHAR Type I created an Address Table for the Star Trek Actors

CREATE TABLE `staaddress` (

-- Let us have the database provide a unique key

`addressID` INT(5) AUTO_INCREMENT,

-- Foreign Key to link to Actor Table

`actorID` INT(5) NOT NULL,

-- The First Half of the Street Address

`streetPartOne` VARCHAR(30) NOT NULL,

-- The Second Half of the Street Address

`streetPartTwo` VARCHAR(30) NOT NULL,

-- The City the address is in

`city` VARCHAR(20) NOT NULL,

-- State Code for address from Drop Down Menu

`state` CHAR(2) NOT NULL,

-- The Zip Code for the address

`zip` CHAR(10) ,

-- Country Code for address From Drop Down Menu

`country Code` CHAR(2) ,

PRIMARY KEY(`addressID`)

);

Notice I have control by using a drop down menu for these fields

CREATE TABLE `stplanets` (

-- Let us have the database provide a unique key

`planetID` INT(5) AUTO_INCREMENT,

`planetName` VARCHAR(50) NOT NULL,

-- Include Alternate Name if it exist

`planetAltName` VARCHAR(50),

-- Classification of Planet

`planetClass` VARCHAR(10) NOT NULL,

-- What special conditions exist

`planetCharacteristics` VARCHAR(100) NOT NULL,

PRIMARY KEY(`planetID`)

);

VARCHAR can be my go to, but do not get too lazy, Storage Size Matters

In A Production Database

I would be Questioning

this last variable

And Really even the VARCHAR(50)’s are stretching it

Data Of Type: Character Example