Advertisement
CuriousStudent

Untitled

Apr 4th, 2023
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.64 KB | None | 0 0
  1.  
  2. ----- q1
  3.  
  4. select * from OrderItems oi
  5. inner join Product on oi.idProduct = Product.idProduct
  6. where Product.unit_price between 1000000 and 1010000
  7. option(maxdop 1)
  8.  
  9.  
  10. ----- q2
  11.  
  12. select count(*),sum(oi.quantity)
  13. from OrderItems oi
  14. inner join Product on oi.idProduct = Product.idProduct
  15. where Product.unit_price between 1000000 and 1010000
  16. option(maxdop 1)
  17.  
  18.  
  19. ----- q3
  20.  
  21. select * from OrderItems oi
  22. inner join Product on oi.idProduct = Product.idProduct
  23. inner join "Order" on oi.idOrder = "Order".idOrder
  24. where Product.name like 'Auto%' and year(order_datetime) = 2022 and oi.unit_price between 1000000 and 1010000
  25. option(maxdop 1)
  26.  
  27.  
Tags: Cviceni 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement