SHARE
TWEET

Untitled

a guest Jun 26th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select p.product_name,
  2. sum(o.quantity) as total_quantity,
  3. case
  4.  
  5. when extract(month from p.warranty_period) = 0
  6.     and extract(year from p.warranty_period) = 0
  7.         then 'No Warranty'
  8. when extract(month from p.warranty_period) = 0
  9.     then extract(year from p.warranty_period) || ' years'
  10. when extract(year from p.warranty_period) = 0
  11.     then extract(month from p.warranty_period) || ' months'
  12. else extract(year from p.warranty_period) || ' years and ' ||
  13.     extract(month from p.warranty_period) || ' months'
  14.  
  15.  end WARRANTY, oe.order_mode from PRODUCT_INFORMATION p
  16. join order_items o on p.product_id = o.product_id
  17. join orders oe on o.order_id = oe.order_id
  18. group by p.product_name, p.warranty_period, oe.order_mode
  19. having sum(o.QUANTITY) > 200
  20. order by p.product_name;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top