SELECT count(*) FROM Shipment_Items
How many items are shipped?
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY ,
`parent_product_id` INTEGER,
`product_name` VARCHAR(80),
`product_price` DECIMAL(19,4) DEFAULT 0,
`product_color` VARCHAR(50),
`product_size` VARCHAR(50),
`product_description` VARCHAR(255)
);
CREATE TABLE `Customers` (
`customer_id` INTEGER PRIMARY KEY,
`gender_code` VARCHAR(1) NOT NULL,
`customer_first_name` VARCHAR(50),
`customer_middle_initial` VARCHAR(1),
`customer_last_name` VARCHAR(50),
`email_address` VARCHAR(255),
`login_name` VARCHAR(80),
`login_password` VARCHAR(20),
`phone_number` VARCHAR(255),
`address_line_1` VARCHAR(255),
`town_city` VARCHAR(50),
`county` VARCHAR(50),
`country` VARCHAR(50)
);
CREATE TABLE `Customer_Payment_Methods` (
`customer_id` INTEGER NOT NULL,
`payment_method_code` VARCHAR(10) NOT NULL,
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
);
CREATE TABLE `Invoices` (
`invoice_number` INTEGER PRIMARY KEY,
`invoice_status_code` VARCHAR(10) NOT NULL,
`invoice_date` DATETIME
);
CREATE TABLE `Orders` (
`order_id` INTEGER PRIMARY KEY,
`customer_id` INTEGER NOT NULL,
`order_status_code` VARCHAR(10) NOT NULL,
`date_order_placed` DATETIME NOT NULL,
FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
);
CREATE TABLE `Order_Items` (
`order_item_id` INTEGER PRIMARY KEY ,
`product_id` INTEGER NOT NULL,
`order_id` INTEGER NOT NULL,
`order_item_status_code` VARCHAR(10) NOT NULL,
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),
FOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )
);
CREATE TABLE `Shipments` (
`shipment_id` INTEGER PRIMARY KEY,
`order_id` INTEGER NOT NULL,
`invoice_number` INTEGER NOT NULL,
`shipment_tracking_number` VARCHAR(80),
`shipment_date` DATETIME,
FOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),
FOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )
);
CREATE TABLE `Shipment_Items` (
`shipment_id` INTEGER NOT NULL,
`order_item_id` INTEGER NOT NULL,
PRIMARY KEY (`shipment_id`,`order_item_id`),
FOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` ),
FOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` )
);
INSERT INTO Products (`product_id`, `parent_product_id`, `product_name`, `product_price`, `product_color`, `product_size`, `product_description`) VALUES (1, 8, 'Dell monitor', '795.6200', 'Red', 'Medium', 'Latest model!')
INSERT INTO Customers (`customer_id`, `gender_code`, `customer_first_name`, `customer_middle_initial`, `customer_last_name`, `email_address`, `login_name`, `login_password`, `phone_number`, `address_line_1`,  `town_city`, `county`, `country`) VALUES (1, 'Female', 'Carmen', 'K', 'Treutel', 'pgulgowski@example.com', 'murphy07', '58952d0e0d28de32db3b', '(253)
INSERT INTO Customer_Payment_Methods (`customer_id`, `payment_method_code`) VALUES (15, 'Direct Debit')
INSERT INTO Invoices (`invoice_number`, `invoice_status_code`, `invoice_date`) VALUES (1, 'Paid', '2018-03-09 07:16:07')
INSERT INTO Orders (`order_id`, `customer_id`, `order_status_code`, `date_order_placed`) VALUES (1, 5, 'Cancelled', '2017-09-17 16:13:07')
INSERT INTO Order_Items (`order_item_id`, `product_id`, `order_id`, `order_item_status_code`) VALUES (1, 4, 8, 'Delivered')
INSERT INTO Shipments (`shipment_id`, `order_id`, `invoice_number`, `shipment_tracking_number`, `shipment_date`) VALUES (1, 7, 5, '6900', '2018-02-28 00:04:11')
INSERT INTO Shipment_Items (`shipment_id`, `order_item_id`) VALUES (4, 4)