Advertisement
davydovdmitry

Untitled

Jan 20th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select distinct product_name
  2. from order_details, products, (
  3.     select order_id, count(product_id) as product_number
  4.     from order_details
  5.     group by order_id)t1,(
  6.     select distinct order_id
  7.     from orders, customers
  8.     where orders.customer_id = customers.customer_id
  9.     and country = 'Germany')t2
  10. where t1.product_number < 5
  11. and t1.order_id = t2.order_id
  12. and order_details.order_id = t1.order_id
  13. and products.product_id = order_details.product_id
  14. order by product_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement