Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Table : PURCHASE ORDER -- ORDER_NO AMOUNT ORDER_DATE CUSTOMER_ID SALESMAN_ID DELIVERY_DATE 1001 300 05-03-2012 2001 3001 OS-05-2017 1002 2002 3003 10-10-2017 200.20 600 400.25 10-07-2017

image text in transcribed
Table : PURCHASE ORDER -- ORDER_NO AMOUNT ORDER_DATE CUSTOMER_ID SALESMAN_ID DELIVERY_DATE 1001 300 05-03-2012 2001 3001 OS-05-2017 1002 2002 3003 10-10-2017 200.20 600 400.25 10-07-2017 12-06-2017 1003 2005 3002 1004 2003 2004 10-05-2017 03-08-2017 10-07-2017 3004 3005 12-08-2017 10-07-2017 03-05-2017 10-10-2017 1005 500.10 400 1006 2005 3006 PRICE Table: PURCHASE DETAILS ORDER_NO PRODUCT_NAME 1001 KEYBOARD 1002 MONITOR 1003 MOUSE QUANTITY 100 56 36 200 100 6 58 300 1004 1005 HARD DISK RAM 25 500 1007 CABINET 5 100 a) Write a SQL query to display PRODUCT_NAME, ORDER DATE and find number of years between the DELIVERY_DATE from the CURRENT DATE [Hint: Use ON Clause). b) Write a SQL query to display matched records from PURCHASE ORDER table and all records from PURCHASE DETAILS. c) Write an SQL query to display ORDER_NO, PRODUCT_NAME from table ORDER_DETAILS of products where the price is less than average price of products. (Hint: Use Subquery]. d) Write an SQL query to display ORDER_NO, PRODUCT_NAME and QUANTITY from PURCHASE DETAILS table where the quantity is greater than all values in quantity for products Mouse and keybbard. (Hint: Use Subquery]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

Students also viewed these Databases questions