Please help with my SQL!! Please answer the following questions by using the cha
ID: 3697402 • Letter: P
Question
Please help with my SQL!!
Please answer the following questions by using the chart.
Display a list of invoice number, invoice customer code, customer last name, and customer first name.
Display a list of invoice number, product code, product description, lint units, and line price.
Generate a list of vendors who do not provide products.
Generate a list of product description, product price, vendor name, vendor contact, vendor are code, and vendor phone number for products with the invoice date after 15-Jan-2014
List the customer last name, invoice number, invoice date, and product description for all invoices for customer 10014.
Find all product with the price greater than or equal to the average product price. (use subquery)
List all products with a total quantity sold greater than the average quantity sold.
Explanation / Answer
i am not sure with 1 and 2 pls gv me some tym i ll provide:
Q)List all products with a total quantity sold greater than the average quantity sold.
SELECT P_CODE, SUM(LINE_UNITS)
FROM LINE
GROUP BY P_CODE
HAVING SUM(LINE_UNITS) > (SELECT AVG(LINE_UNITS) FROM LINE);
Q)Generate a list of product description, product price, vendor name, vendor contact, vendor are code, and vendor phone number for products with the invoice date after 15-Jan-2014
SELECT P_DESCRIPT, P_PRICE, V_NAME, V_CONTACT, V_AREACODE, V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE = VENDOR.V_CODE
AND P_INDATE > '15-JAN-2014'
Q)List the customer last name, invoice number, invoice date, and product description for all invoices for customer 10014.
SELECT CUS_LNAME, INVOICE.INV_NUMBER, INV_DATE, P_DESCRIPT
FROM CUSTOMER, INVOICE, LINE, PRODUCT
WHERE CUSTOMER.CUS_CODE = INVOICE.CUS_CODE
AND INVOICE.INV_NUMBER = LINE.INV_NUMBER
AND LINE.P_CODE = PRODUCT.P_CODE
AND CUSTOMER.CUS_CODE = 10014
ORDER BY INVOICE.INV_NUMBER
Q)Find all product with the price greater than or equal to the average product price
SELECT P_CODE,P_PRICE FROM PRODUCT
WHERE P_PRICE>=(SELECT AVG(P_PRICE)FROM PRODUCT
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.