From c10a825ab1c74d26a62d5f40ebdcce38003cf66b Mon Sep 17 00:00:00 2001 From: Youry Date: Mon, 27 Jun 2022 22:36:52 -0700 Subject: [PATCH] orders APEX ddl --- exams/final/OrdersOracleAPEXFinal.sql | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 exams/final/OrdersOracleAPEXFinal.sql diff --git a/exams/final/OrdersOracleAPEXFinal.sql b/exams/final/OrdersOracleAPEXFinal.sql new file mode 100644 index 0000000..e0d9214 --- /dev/null +++ b/exams/final/OrdersOracleAPEXFinal.sql @@ -0,0 +1,34 @@ +drop table Orders cascade constraints; +drop table OrderedProduct cascade constraints; + +CREATE TABLE Orders ( + orderId integer, + orderDate DATE, + PRIMARY KEY (orderId) +); + +INSERT INTO Orders VALUES (1, to_date('2016-10-10','yyyy-mm-dd')); +INSERT INTO Orders VALUES (2, to_date('2017-09-23','yyyy-mm-dd')); +INSERT INTO Orders VALUES (3, to_date('2018-11-22','yyyy-mm-dd')); +INSERT INTO Orders VALUES (4, to_date('2019-12-02','yyyy-mm-dd')); +INSERT INTO Orders VALUES (5, to_date('2019-12-03','yyyy-mm-dd')); + +CREATE TABLE OrderedProduct ( + orderId integer, + productId integer, + quantity integer, + pricePerItem decimal(10,2), + PRIMARY KEY (orderId, productId), + FOREIGN KEY (orderId) REFERENCES Orders (orderId) +); + +INSERT INTO OrderedProduct VALUES (1, 55, 5, 200); +INSERT INTO OrderedProduct VALUES (1, 3, 4, 600); +INSERT INTO OrderedProduct VALUES (2, 1, 10, 400); +INSERT INTO OrderedProduct VALUES (2, 55, 3, 500); +INSERT INTO OrderedProduct VALUES (3, 32, 23, 100); +INSERT INTO OrderedProduct VALUES (3, 19, 10, 80); +INSERT INTO OrderedProduct VALUES (4, 46, 5, 400); +INSERT INTO OrderedProduct VALUES (4, 55, 4, 250); +INSERT INTO OrderedProduct VALUES (4, 20, 2, 300); +INSERT INTO OrderedProduct VALUES (5, 19, 5, 50); \ No newline at end of file