마

SQL Basics - Joins

· 2019-06-22 (토) 00:21:32 · 851

Join에 대해서는 별도로 설명..

 

제품을 Join시킨경우

select * from customer.orders
inner join Products on Orders.ProductId=Products.id;

 

as로 긴 네임을 짧게

 

select * from customer.orders as o
inner join Products as p on o.ProductId=p.id;

 

AS도 줄이자..

 

select * from customer.orders o
inner join Products p on o.ProductId=p.id;

 

전체를 볼 필요없이

select o.*, p.*, c.* from customer.orders o
inner join Products p on o.ProductId=p.id
inner join Customer c on o.CustomerID=c.id;

 

필요한 것만 표시하자..

select o.OrderDate, p.ProductName, p.Price, c.* from customer.orders o
inner join Products p on o.ProductId=p.id
inner join Customer c on o.CustomerID=c.id;

 

링크를 클릭하세요

https://youtu.be/9Pzj7Aj25lw?list=PLD20298E653A970F8&t=3030

|
댓글을 작성하시려면 로그인이 필요합니다.

그누5튜닝

64건
+
제목 글쓴이 날짜 조회
19-06-23 조회 1,181
19-06-23 조회 970
19-06-23 조회 1,051
19-06-23 조회 1,146
19-06-22 조회 1,420
19-06-22 조회 1,020
19-06-22 조회 852
19-06-22 조회 1,074
19-06-22 조회 891
19-06-21 조회 656
19-06-21 조회 800
19-06-21 조회 752
19-06-20 조회 735
19-06-20 조회 691
19-06-20 조회 1,318
19-06-19 조회 1,904
19-06-19 조회 1,622
19-06-18 조회 875
19-06-18 조회 865
19-06-17 조회 1,529
19-05-23 조회 775
18-07-14 조회 946
18-03-28 조회 1,231
15-11-22 조회 3,387
15-11-15 조회 2,624
15-10-29 조회 1,628
15-10-28 조회 1,767
15-10-28 조회 3,642
15-10-27 조회 1,244
15-10-27 조회 1,348