Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --1
- Select C.CustomerID, CompanyName, Count(*)
- from Orders O inner join Customers C on O.CustomerID = C.CustomerID and year(orderDate) = 1997
- group by C.CustomerID, CompanyName
- --2
- Select P.ProductID, ProductName, Round(sum(Quantity*O.UnitPrice*(1 - Discount)), 0) as Bablo
- from [Order Details] O inner join Products P on P.ProductID=O.ProductID
- group by P.ProductID, ProductName
- order by P.ProductID, ProductName
- --4
- Select top(3) CategoryName, P.CategoryID, Count(*) as Kol
- from Products P inner join Categories C on (C.CategoryID = P.CategoryID and UnitPrice > 10)
- group by P.CategoryID, CategoryName
- --5
- Select E.EmployeeID, LastName, FirstName, ShipCity, Count(*)
- from Employees E inner join Orders O on O.EmployeeID = E.EmployeeID and ShipCity = ('Paris')
- group by E.EmployeeID, ShipCity , LastName, FirstName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement