First page Back Continue Last page Image

CREATE TABLE `sfpeople` (

-- Let us have the database provide a unique key

`lfID` INT(5) AUTO_INCREMENT,

-- The First Name of the Member

`lfFirstName` VARCHAR(20) NOT NULL,

-- The Last Name of the Member

`lfLastName` VARCHAR(20) NOT NULL,

-- Where are they from

`homeworld` INT(5),

-- What Gender classification do they fall into

`gender` ENUM('Dual','Inter','Female','Male','Hybrid','Multi','Cyber') NOT NULL,

-- What elements can this lifeform breathe

`environment` SET('Oxygen','Nitrogen','Helium','Carbon','Sulfur','Hydrogen') NOT NULL,

PRIMARY KEY(`lfID`)

);

-- Populate initial data into table

INSERT INTO `sfpeople` VALUES

(NULL, 'Michael', 'Burnham', 2, 'Female', 'Oxygen,Nitrogen'),

(NULL, 'Keyla', 'Detmer', 1, 'Female', 'Oxygen,Nitrogen'),

(NULL, 'Benjamin', 'Sisko', 1, 4, 'Oxygen,Nitrogen'),

(NULL, 'Worf', 'Mogh', 3, 'Male', 'Oxygen,Nitrogen,Sulfur'),

(NULL, 'Jadzia', 'Dax', 4, 'Hybrid', 'Oxygen,Nitrogen'),

(NULL, 'D\'sut', 'Tuvok', 2, 'Male', 'Oxygen,Nitrogen,Hydrogen'),

(NULL, 'B\'Elenna', 'Torres', 3, 2, 'Oxygen,Nitrogen,Sulfur'),

(NULL, 'Philippa', 'Georgiou', 1, 'Female', 'Oxygen,Nitrogen'),

(NULL, 'Annika', 'Hansen', 1, 'Hybrid', 'Oxygen,Nitrogen,Carbon,Sulfur,Hydrogen');

In the ENUM Type your Mutually Exclusive Options are presented as a list

The field can then contain one (and only one) of the approved options

Notice This

The ENUM (Radio Button) Data Type