Question
14.A. Find the item titles and the corresponding order ids. HERE ITEMS , ORDER_DETAILS TABLE CONTAIN SELECT TITLE, ORDER_ID FROM ITEMS I FULL JOIN ORDER_DETAILS
14.A. Find the item titles and the corresponding order ids.
HERE ITEMS , ORDER_DETAILS TABLE CONTAIN
SELECT TITLE, ORDER_ID FROM ITEMS I FULL JOIN ORDER_DETAILS D ON I.ITEM_ID = D.ITEM_ID
B. Now count the number of orders ach item has been included in.
BUT HOW DO I COUNT (ORDER_id)
I TRY
SELECT TITLE, ORDER_ID, COUNT(ORDER_ID) FROM ITEMS I FULL JOIN ORDER_DETAILS D ON I.ITEM_ID = D.ITEM_ID
GROUP BY ORDER_ID;
BUT RESULT IS NOT COME OUT
C. Now report only those items that have been included in more than 5 different orders
SELECT TITLE, ORDER_ID FROM ITEMS I FULL JOIN ORDER_DETAILS D ON I.ITEM_ID = D.ITEM_ID WHERE D.ORDER_DETAILS >5; SAME NO RESULT
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