Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2.1 When using joins to query a database, what is the purpose of qualifiers and when are you required to use them? (3 marks) 2.2
2.1 When using joins to query a database, what is the purpose of qualifiers and when are you required to use them? (3 marks) 2.2 What is the difference between the (JOIN ....USING) and (JOIN ....ON) approaches for joining tables? (2 marks) 2.3 Based on the tables of the JustLee books database (Annexure A at the end of question paper), display a list of all books in the BOOKS table. If the customer has ordered a book, also list the corresponding order number and identify the State in which the customer resides. Create the query using the traditional OUTER JOIN operator based on the following tables: BOOKS, ORDERS, ORDERITEMS and CUSTOMERS. (5 marks) 2.4 Based on the tables of the JustLee books database (Annexure A at the end of question paper), determine the average profit generated by the orders in the ORDERS table. Calculate the total profit of the orders before finding the average profit. Create the query using group functions AVG, SUM and GROUP BY. Base your query on the BOOKS, ORDERS and ORDERITEMS tables. (10 marks) Annexure A JustLee Books E-R diagram Describe Customers Object Type TABLE Object CUSTOMERS Select * from Customer Describe Orders Results Explain Describe Saved SQL History Object Type TABLE Object ORDERS Select * from Orders Describe orderitems Results Explain Describe Saved SQL History Object Type TABLE Object ORDERITEMS Select * from orderitems \begin{tabular}{ccccc} \hline Results & Explain & Describe & \multicolumn{3}{l}{ Saved SQL } & History \\ \hline & & & \\ \hline ORDER\# & ITEM\# & ISBN & QUANTITY & PAIDEACH \\ \hline 1000 & 1 & 3437212490 & 1 & 19.95 \\ \hline 1001 & 1 & 9247381001 & 1 & 31.95 \\ \hline 1001 & 2 & 2491748320 & 1 & 85.45 \\ \hline 1002 & 1 & 8843172113 & 2 & 55.95 \\ \hline 1003 & 1 & 8843172113 & 1 & 55.95 \\ \hline 1003 & 2 & 1059831198 & 1 & 30.95 \\ \hline 1003 & 3 & 3437212490 & 1 & 19.95 \\ \hline 1004 & 1 & 2491748320 & 2 & 85.45 \\ \hline 1005 & 1 & 2147428890 & 1 & 39.95 \\ \hline 1006 & 1 & 9959789321 & 1 & 54.5 \\ \hline 1007 & 1 & 3957136468 & 3 & 72.15 \\ \hline \end{tabular} Describe books Results Explain Describe Saved SQL History Object Type TABLE Object BOOKS Describe bookauthor
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started