Please help me on this MySQL question (Only Q2). Please send me results if possi
ID: 3701822 • Letter: P
Question
Please help me on this MySQL question (Only Q2). Please send me results if possible. Appreciate your help
Using sub-queries as demonstrated in the textbook, complete the following tasks.
1. Use a sub-query to list the order number and order date for each order that was placed by Johnson’s Department Store and that contains an order line for a Gas Range. How many rows did your query return?- I have done this: ( I don't need this, I need answer to Q2)
SELECT ORDER_NUM,ORDER_DATE FROM ORDERS WHERE CUSTOMER_NUM = (SELECT CUSTOMER_NUM FROM CUSTOMER WHERE CUSTOMER_NAME ='Johnson''s Department Store');
2. Rewrite step 1 above to list the order number and order date for each order that was placed by Johnson’s Department Store but that does not contain an order line for a Gas Range- Need answer to this question.
MySQL premiere Database file:
Explanation / Answer
SELECT ORDER_NUM,ORDER_DATE FROM ORDERS WHERE CUSTOMER_NUM =(SELECT CUSTOMER_NUM FROM CUSTOMER WHERE CUSTOMER_NAME ='Johnson''s Department Store')
AND ORDER_NUM NOT IN (SELECT ORDER_NUM FROM ORDER_LINE WHERE PART_NUM = (SELECT PART_NUM FROM PART WHERE DESCRIPTION = 'Gas Range'))