SQL(3)

신홍석·2022년 6월 28일
0
post-custom-banner

4가지 기본 죠인
Cross Join, Left Join, Right Join, Inner Join

Inner Join 교집합
Outer Join 합집합

ex1) customer 과 orders 의 join

SELECT *
FROM Customers cs
inner join orders ord ON cs.customerid = ord.customerid
;

ex2)
SELECT *
FROM Customers cs
inner join orders ord ON cs.customerid = ord.customerid
WHERE cs.Country = 'Mexico'
;

ex3)
SELECT cs.customerid, orderdate, orderid, customername
FROM customers cs left join orders od on cs.customerid = od.customerid
where orderdate between '1996-07-01' and '1996-07-31'
order by orderdate desc
;

profile
백엔드 개발자 공부
post-custom-banner

0개의 댓글