SQL Basics - Joins

· 6년 전 · 785

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;

 

링크를 클릭하세요

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

그누5튜닝

+
제목 글쓴이 날짜 조회
6년 전 조회 1,306
6년 전 조회 1,284
6년 전 조회 1,410
6년 전 조회 1,377
6년 전 조회 3,306
6년 전 조회 1,489
6년 전 조회 1,497
6년 전 조회 1,529
6년 전 조회 1,108
6년 전 조회 877
6년 전 조회 982
6년 전 조회 1,083
6년 전 조회 1,360
6년 전 조회 933
6년 전 조회 786
6년 전 조회 1,017
6년 전 조회 830
6년 전 조회 601
6년 전 조회 747
6년 전 조회 691
6년 전 조회 694
6년 전 조회 640
6년 전 조회 1,262
6년 전 조회 1,821
6년 전 조회 1,567
6년 전 조회 819
6년 전 조회 796
6년 전 조회 1,474
6년 전 조회 711
7년 전 조회 898