Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use NORTHWND
- --unit price
- --quantity
- --ship country
- --category name
- --wykres sumy sprzedazy w podziale kategorii i kraj wysylki
- create view
- wykres as
- select sum(od.UnitPrice*quantity)as 'suma sprzedazy', categoryname, shipcountry
- from orders o join [Order Details] od on o.OrderID = od. OrderID
- join products p on p.ProductID = od.ProductID
- join Categories c on c.CategoryID = p.CategoryID
- group by CategoryName, ShipCountry
- select * from wykres
- -- wartosc zamowien skladanych z polski w poszczegolnych dniach tygonida
- create view
- wykres3 as
- select country, DATENAME(weekday, orderdate) as 'dzien tygodnia',sum(od.UnitPrice*quantity)as 'suma sprzedazy'
- from orders o join [Order Details] od on o.OrderID = od. OrderID
- join Customers c on c.CustomerID = o.CustomerID
- where country = 'POLAND'
- group by country, DATENAME(weekday, orderdate)
- select * from wykres3
- -- liczba zamowien z usa w poszczegolnych miesiacach i latach na roznych poziomach szczegolowosci
- select shipcountry, year(orderdate) as'rok', month(orderdate) as 'miesiac', sum(od.UnitPrice*quantity) as 'suma sprzedazy'
- from orders o join [Order Details] od on o.OrderID = od.OrderID
- group by ShipCountry, year(orderdate), month(orderdate)
- -- trzeba zrobic groupingi ale mi sie nie chce 😞
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement