SQL 1

You might also like

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

--- Question 10.

Write a query to display the order_id,customer_id and customer fullname, total


quantity of products shipped for order ids which are even and shipped to address where pincode is
not starting with "5" -- [NOTE: TABLES to be used - online_customer,Order_header,
order_items,address]

select ohl.ORDER_ID,

ocl.CUSTOMER_ID,

concat(CUSTOMER_FNAME,' ',CUSTOMER_LNAME) as Name ,

sum(ol.PRODUCT_QUANTITY) as Total_quantity

from online_customer ocl

join order_header ohl on ocl.CUSTOMER_ID=ohl.CUSTOMER_ID

join order_items ol on ohl.ORDER_ID=ol.ORDER_ID

join address a on ocl.ADDRESS_ID=a.ADDRESS_ID

where

ol.ORDER_ID %2= 0

and a.PINCODE not like '5%'

group by 1,2;

You might also like