SQL Basics - Joins

· 6년 전 · 681

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튜닝

+
제목 글쓴이 날짜 조회
6년 전 조회 1,199
6년 전 조회 1,167
6년 전 조회 1,299
6년 전 조회 1,256
6년 전 조회 3,190
6년 전 조회 1,378
6년 전 조회 1,383
6년 전 조회 1,402
6년 전 조회 997
6년 전 조회 788
6년 전 조회 901
6년 전 조회 1,002
6년 전 조회 1,266
6년 전 조회 805
6년 전 조회 682
6년 전 조회 913
6년 전 조회 740
6년 전 조회 514
6년 전 조회 657
6년 전 조회 606
6년 전 조회 598
6년 전 조회 549
6년 전 조회 1,173
6년 전 조회 1,726
6년 전 조회 1,438
6년 전 조회 730
6년 전 조회 730
6년 전 조회 1,404
6년 전 조회 644
7년 전 조회 826
🐛 버그신고