Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

--- Question 8.

Write a query to display customer id, customer full name, total quantity and total
value (quantity*price) shipped where mode of payment is Cash and customer last name starts with
'G' --[NOTE: TABLES to be used - ONLINE_CUSTOMER, ORDER_ITEMS, PRODUCT, ORDER_HEADER]

select ca.CUSTOMER_ID, concat(CUSTOMER_FNAME,' ',CUSTOMER_LNAME) as Full_Name,

sum(ol.PRODUCT_QUANTITY) as total_quantity,

sum(ol.PRODUCT_QUANTITY*pro.PRODUCT_PRICE) as total_value

from online_customer ca

join order_header ohl on ca.CUSTOMER_ID=ohl.CUSTOMER_ID

join order_items ol on ohl.ORDER_ID=ol.ORDER_ID

join product pro on ol.PRODUCT_ID=pro.PRODUCT_ID

where PAYMENT_MODE='cash' and CUSTOMER_LNAME like 'G%'

group by CUSTOMER_ID;

You might also like