Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

3/ lay danh sach khach hag mua hang trong nam 1998

select companyname, contactname, orderdate


from customers c, orders o
where c.CustomerID = o.CustomerID and
year(orderdate)=1998

select companyname, contactname, orderdate


from customers c left join orders o
on o.CustomerID=c.CustomerID
where year(orderdate)=1998

4/ lay danh sach cac san pham da ban cho khach hang 'ANTON'

select o.customerid,e.*
from customers o full join orders e
on o.customerid=e.customerid
where e.customerid='ANTON'

select o.customerid,e.*
from customers o, orders e
where o.customerid=e.customerid
and e.customerid='ANTON'

5/*lay thong tin cac khach hang mua san pham co ten la 'chai'*/

select o.*, od.orderid


from products o full join [order details] od
on o.productid=od.productid
where productname like 'chai'

select o.*, od.orderid


from products o, [order details] od
where o.productid=od.productid
and productname like 'chai'

6/*lay ds cac khach hag ma nhan vien 3 da ban hang*/

You might also like