Write SQL code that could be used from these seven tables below 1. List the tota
ID: 3699381 • Letter: W
Question
Write SQL code that could be used from these seven tables below 1. List the total number of part...
Write SQL code that could be used from these seven tables below
1. List the total number of parts ordered on each day. Rank your results in ascending order on
order date.
2. List the full name and mailing address of customers who placed an order on 04-AUG-2013. If
same customer has placed more than one order on this day, only show his/her information
once.
3. List the order date, order number, total quoted price for each order placed between 03-AUG-
2013 and 06-AUG-2013.
Table: PART Column Data Type gth Precision Scale Nullable PART NUMBER PART DESCRIPTION UNITS ON HAND ITEM CLASS WAREHOUSE NUMBERNUMBER UNIT PRICE VARCHAR2 VARCHAR2 NUMBER CHAR No - Yes Yes - Yes Yes 2 Yes 12 NUMBE 7Explanation / Answer
using group by and order by clause
1) SELECT or.ORDER_NUMBER,COUNT(p.PART_NUMBER) FROM PART p,ORDER_LINE o,ORDERS or WHERE p.PART_NUMBER=o.PART_NUMBER AND o.ORDER_NUMBER=or.ORDER_NUMBER GROUP BY or=ORDER_DATE ORDER BY or.ORDER_DATE ASC
2) SELECT c.CLAST,c.CFIRST,c.STREET,c.CITY,c.STATE,c.ZIPCODE FROM CUSTOMER c,ORDERS o WHERE c.C_NUMBER=o.C_NUMBER AND o.ORDER_DATE='04-AUG-2013' HAVING COUNT(o.ORDER_DATE)>1
Between Clause
3) SELECT o.ORDER_DATE,o.ORDER_NUMBER,ol.QUOTED_PRICE FROM ORDERS o,ORDER_LINE ol WHERE o.ORDER_NUMBER=ol.ORDER_NUMBER AND o.ORDER_DATE BETWEEN '03-AUG-2013' AND '06-AUG-2013'
or
SELECT o.ORDER_DATE,o.ORDER_NUMBER,ol.QUOTED_PRICE FROM ORDERS o,ORDER_LINE ol WHERE o.ORDER_NUMBER=ol.ORDER_NUMBER AND o.ORDER_DATE BETWEEN #08/03/3013# AND #08/06/2013#
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.