Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. --1
  2. Select C.CustomerID, CompanyName, Count(*)
  3. from Orders O inner join Customers C on O.CustomerID = C.CustomerID and year(orderDate) = 1997
  4. group by C.CustomerID, CompanyName
  5.  
  6. --2
  7. Select P.ProductID, ProductName, Round(sum(Quantity*O.UnitPrice*(1 - Discount)), 0) as Bablo
  8. from [Order Details] O inner join Products P on P.ProductID=O.ProductID
  9. group by P.ProductID, ProductName
  10. order by P.ProductID, ProductName
  11.  
  12. --4
  13. Select top(3) CategoryName, P.CategoryID, Count(*) as Kol
  14. from Products P inner join Categories C on (C.CategoryID = P.CategoryID and UnitPrice > 10)
  15. group by P.CategoryID, CategoryName
  16.  
  17.  
  18. --5
  19. Select E.EmployeeID, LastName, FirstName, ShipCity, Count(*)
  20. from Employees E inner join Orders O on O.EmployeeID = E.EmployeeID and ShipCity = ('Paris')
  21. group by E.EmployeeID, ShipCity , LastName, FirstName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement