Question: Refer to the relational database schema and sample Orders data described in Appendix A NB: Your code must work for any data set. Therefore, do

 Refer to the relational database schema and sample Orders data describedin Appendix A NB: Your code must work for any data set.

Refer to the relational database schema and sample Orders data described in Appendix A NB: Your code must work for any data set. Therefore, do not hardwire your SOL code to the sample data given in the appendix. The target output (answer) is given in each query, based on the sample data set. However, this is only a guide to understanding the required programming. Your SQL code must implement the queries in the general case. Using the Orders database write SQL select statements to: 1.1 Find products made by the Hoover that cost more than 400? Ans: P3, Hoover Fridge 5 Marks 1.2 Find the list of Product numbers where the Order sale price (S_price) is less than the actual Product price (Price). Hint: find the Products that have been ordered and then filter rows based on the price difference condition. Ans P4, P5 5 Marks 1.3. List the date(s) of orders for the product named Acer 323. 2016-06-01', '2017-02-10 6 Mark Appendix A Orders database sample data Order Design Solutions Tables & data The following database is designed for a company that sells products to customers. Each product is at- tached to a department within the company e.g. there are departments for Computer, Home, Furniture etc. Each order is unique and links a customer to a list of products and quantities. An employee is respon- sible for each order (PrsiNo recorded in each order). The Paid field records a Yes/No value if the order has been paid for or not. Employees work in a given department. Primary keys are in bold and underlined; foreign keys are bold and in italics. CUSTOMERS (CNO CName, Address, Sex) EMPS (PPSNO EName, DeptName) PRODUCTS (PNO PName, Price, DeptName) ORDERS (Ord No. CNO, ODate, Paid, PPSNO) ORDER_DETAILS (OrdNo, PNo qty) Emps PPSNO ename DeptName E1 Jim Furniture Byron Computer Frank Computer Jane Home Products Pnopname P1 Dell XP22 P2 Acer 323 P3 Hoover Fridae P4 Red Sofa P5 Apple iPad P6 Old Mac Price deptname 450.00 Computer 600.00 Computer 500.00 Home 750.00 Furniture 870.00 Computer 200.00 Computer Customers Cno came C1 B.Treacy CZ J.Jones C3 B.Blake C4 C.Clark C5 A.Adams Address London Paris Paris London Athens Gender Male Female Female Male Male Orders Ordno cno 01 01 02 01 C2 Order details Ordno pno qty 01 P11 01 P2 4 02 P1 2 02 P2 1 P32 P4 3 P31 P14 P5 2 S Price 450.00 600.00 450.00 600.00 500.00 650.00 500.00 450.00 Date Paid 2016-06-01 Yes 2017-02-10 No 2017-04-20 No 2017-01-30 Yes 2016-03-03 Yes PPSNO E1 E2 E2 800.00 05 03 E2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!