Load phpMyAdmin, select the tshirtshop database, and open a new SQL query page.
2. Execute this code, which creates the shipping_region table in your tshirtshop database:
-- Create shipping_region table
CREATE TABLE `shipping_region` (
`shipping_region_id` INT NOT NULL AUTO_INCREMENT,
`shipping_region` VARCHAR(100) NOT NULL,
PRIMARY KEY (`shipping_region_id`)
);
3. Now add the values "Please select", "US / Canada", "Europe", and "Rest of the World" to
the shipping_region table. "Please Select" should always have a shipping_region_id value of
1??”this is important! Execute the following SQL code to add the mentioned values to the
shipping_region table:
-- Populate shipping_region table
INSERT INTO `shipping_region` (`shipping_region_id`, `shipping_region`) VALUES
(1, 'Please Select') , (2, 'US / Canada'),
(3, 'Europe'), (4, 'Rest of World');
4. Execute the following code, which creates the customer table in your tshirtshop database:
-- Create customer table
CREATE TABLE `customer` (
`customer_id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL,
`email` VARCHAR(100) NOT NULL,
`password` VARCHAR(50) NOT NULL,
`credit_card` TEXT,
`address_1` VARCHAR(100),
`address_2` VARCHAR(100),
`city` VARCHAR(100),
CHAPTER 16 ?– MANAGING CUSTOMER DETAILS 479
`region` VARCHAR(100),
`postal_code` VARCHAR(100),
`country` VARCHAR(100),
`shipping_region_id` INTEGER NOT NULL DEFAULT 1,
`day_phone` VARCHAR(100),
`eve_phone` VARCHAR(100),
`mob_phone` VARCHAR(100),
PRIMARY KEY (`customer_id`),
UNIQUE KEY `idx_customer_email` (`email`),
KEY `idx_customer_shipping_region_id` (`shipping_region_id`)
);
Customers??™ credit card information will be stored in an encrypted format so that no one will be able to access this
information.
Pages:
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600