1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| DROP TABLE if EXISTS Product; DROP TABLE if EXISTS Sales; CREATE TABLE If NOT EXISTS Product (product_id INT, product_name VARCHAR(10), unit_price INT); CREATE TABLE If NOT EXISTS Sales ( seller_id INT, product_id INT, buyer_id INT, sale_date DATE, quantity INT, price INT ); TRUNCATE TABLE Product; INSERT INTO Product (product_id, product_name, unit_price) VALUES ('1', 'S8', '1000'); INSERT INTO Product (product_id, product_name, unit_price) VALUES ('2', 'G4', '800'); INSERT INTO Product (product_id, product_name, unit_price) VALUES ('3', 'iPhone', '1400'); TRUNCATE TABLE Sales; INSERT INTO Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) VALUES ('1', '1', '1', '2019-01-21', '2', '2000'); INSERT INTO Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) VALUES ('1', '2', '2', '2019-02-17', '1', '800'); INSERT INTO Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) VALUES ('2', '2', '3', '2019-06-02', '1', '800'); INSERT INTO Sales (seller_id, product_id, buyer_id, sale_date, quantity, price) VALUES ('3', '3', '4', '2019-05-13', '2', '2800');
|