You are on page 1of 1

--- Question 7.

Write a query to display order_id and volume of the biggest order (in terms of
volume) that can fit in carton id 10 -- [NOTE: TABLES to be used - CARTON, ORDER_ITEMS, PRODUCT]

Select orde.ORDER_ID, (pro.LEN*pro.WIDTH*pro.HEIGHT) PRODUCT_VOLUME

from product pro join order_items orde using(PRODUCT_ID)

where (pro.LEN*pro.WIDTH*pro.HEIGHT) <= (Select (car.LEN*car.WIDTH*car.HEIGHT)

CARTON_VOLUME from carton car

where CARTON_ID=10)

order by PRODUCT_VOLUME DESC limit 1;

You might also like