Lab10



--7

select MONTH(Orders.OrderDate), Year(Orders.OrderDate), ProductName from Products,Orders
where
not exists(
select * from Orders o join [Order Details] on o.OrderID=[Order Details].OrderID
and MONTH(o.OrderDate)=MONTH(Orders.OrderDate) and Year(o.OrderDate)=Year(Orders.OrderDate) and Products.ProductID=[Order Details].ProductID
)
group by
MONTH(Orders.OrderDate), Year(Orders.OrderDate), ProductName
order by 2,1



--8


select MONTH(Orders.OrderDate) m, Year(Orders.OrderDate) y, ProductName from Products,Orders
except
select MONTH(o.OrderDate), Year(o.OrderDate), ProductName from
Customers c join Orders o on o.CustomerID=c.CustomerID
join [Order Details] od on o.OrderID=od.OrderId
join Products p on p.ProductID=od.ProductID


--9

select m,y,COUNT(*) from
(select MONTH(Orders.OrderDate) m, Year(Orders.OrderDate) y, ProductName p from Products,Orders
where
not exists(
select * from Orders o join [Order Details] on o.OrderID=[Order Details].OrderID
and MONTH(o.OrderDate)=MONTH(Orders.OrderDate) and Year(o.OrderDate)=Year(Orders.OrderDate) and Products.ProductID=[Order Details].ProductID
)
group by MONTH(Orders.OrderDate), Year(Orders.OrderDate), ProductName) q
group by m,y




















Wyszukiwarka

Podobne podstrony:
lab10(1)
lab10
I9G1S1 Nadolny Michal Lab10
lab10
lab10 Verilog
fiza lab10
lab10
AiP Lab10
sop 2009 lab10
lab10
Lab10 occ
i2 lab10
lab10 macierze wektory
lab10 AC
panek LAB10
lab10
Lab10 RSVP
Lab10 integracja z ms?cess

więcej podobnych podstron