Execute the following code, which populates the shipping table from the tshirtshop database:
-- Populate shipping table
INSERT INTO `shipping` (`shipping_id`, `shipping_type`,
`shipping_cost`, `shipping_region_id`) VALUES
(1, 'Next Day Delivery ($20)', 20.00, 2),
(2, '3-4 Days ($10)', 10.00, 2),
(3, '7 Days ($5)', 5.00, 2),
(4, 'By air (7 days, $25)', 25.00, 3),
(5, 'By sea (28 days, $10)', 10.00, 3),
(6, 'By air (10 days, $35)', 35.00, 4),
(7, 'By sea (28 days, $30)', 30.00, 4);
4. Execute this code, which adds the tax table to the tshirtshop database:
-- Create tax table
CREATE TABLE `tax` (
`tax_id` INT NOT NULL AUTO_INCREMENT,
`tax_type` VARCHAR(100) NOT NULL,
`tax_percentage` NUMERIC(10, 2) NOT NULL,
PRIMARY KEY (`tax_id`)
);
5. Execute the following code, which populates the tax table from the tshirtshop database:
-- Populate tax table
INSERT INTO `tax` (`tax_id`, `tax_type`, `tax_percentage`) VALUES
(1, 'Sales Tax at 8.5%', 8.50),
(2, 'No Tax', 0.00);
CHAPTER 17 ?– STORING CUSTOMER ORDERS 561
6. Execute this code, which adds the column shipping_id and a new index to the orders table from the
tshirtshop database:
-- Adding a new field named shipping_id to orders table
ALTER TABLE `orders` ADD COLUMN `shipping_id` INT;
-- Adding a new index to orders table
CREATE INDEX `idx_orders_shipping_id` ON `orders` (`shipping_id`);
7.
Pages:
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674