Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Table : PURCHASE ORDER ORDER_NO AMOUNT ORDER_DATE CUSTOMER_ID SALESMAN_ID DELIVERY_DATE 300 200.20 600 1001 1002 1003 1004 1005 1006 05-03-2017 10-07-2017 12-06-2017 10-05-2017 03-08-2017 10-07-2017
Table : PURCHASE ORDER ORDER_NO AMOUNT ORDER_DATE CUSTOMER_ID SALESMAN_ID DELIVERY_DATE 300 200.20 600 1001 1002 1003 1004 1005 1006 05-03-2017 10-07-2017 12-06-2017 10-05-2017 03-08-2017 10-07-2017 2001 2002 2005 2003 2004 2005 3001 3003 3002 3004 3005 3006 05-05-2017 10-10-2017 12-08-2017 10-07-2017 03-05-2017 10-10-2017 400.25 500.10 400 PRICE 56 36 Table: PURCHASE_DETAILS ORDER_NO PRODUCT_NAME 1001 KEYBOARD 1002 MONITOR 1003 MOUSE 1004 HARD_DISK 1005 RAM 1007 CABINET 6 QUANTITY 100 200 100 300 500 100 58 25 5 a. Write an SQL query to display PRODUCT_NAME, ORDER_DATE and find no of months between the DELIVERY_DATE from the CURRENT DATE. (Hint: Use Inner join). b. Write an SQL query to display all records from both tables PURCHASE_ORDER and PURCHASE _DETAILS. c. Write an SQL query to display ORDER_NO, PRODUCT_NAME from table PURCHASE_DETAILS of products where the ORDER_NO is equal to the order_no placed in the date 05-05-2017. (Hint: Use Subquery] d. Write an SQL query to display ORDER_NO, PRODUCT_NAME, QUANTITY from PURCHASE _DETAILS table where the quantity is less than all values in Quantity for products except Mouse and keyboard. (Hint: Use Subquery]
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