Advertisement
Guest User

Lab 5

a guest
Aug 23rd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. --1--
  2. SELECT SUM(UnitPrice) AS 'TOTAL_PRICE' From Product
  3. Where SupplierID=(Select SupplierID from Supplier where SupplierName = 'Fresh Hut')
  4.  
  5. --2--
  6. SELECT top 3 UnitPrice AS 'TOP3_PRICE', ProductName from Product
  7. where SupplierID=(Select SupplierID from Supplier where SupplierName = 'Fresh Hut')
  8. Order By UnitPrice Desc
  9.  
  10. --3--
  11. SELECT ProductID, ProductName, UnitPrice, Quantity, CategoryID, SupplierID From Product
  12. where CategoryID=(Select CategoryID from Category where CategoryName = 'Sweet & Junk Food')
  13. and
  14. SupplierID=(Select SupplierID from Supplier where SupplierName = 'Deli Cream')
  15.  
  16. --4--
  17. Select*From Purchase
  18. Where CustomerID IN (Select CustomerID From Customer where FirstName = 'Lydia')
  19. and
  20. PurchaseQuantity >= 2
  21.  
  22. --5--
  23. Select*From Purchase
  24. where CustomerID IN (Select CustomerID From Customer where City = 'Cyberjaya')
  25.  
  26. --6--
  27. Select COUNT(PurchaseQuantity) AS 'TOTAL_PURCHASE', PurchaseDate From Purchase
  28. Where PurchaseDate > '2018-04-09'
  29. and CustomerID IN (Select CustomerID From Customer Where LastName like '%a%')
  30. Group By PurchaseDate
  31. having COUNT(CustomerID) > 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement