SQL 조인
내부 조인
SQL 쿼리:
SELECT * FROM A INNER JOIN B ON A.KEY = B.KEY
정의 :
Select tables A & B and compare key values of table A and table B and return records which only have the identical key values in both tables of A & B. This is similar to the Set theory operation Intersection
which is denoted by A ∩ B, the set containing all elements of A that also belong to B.
왼쪽 조인
SQL 쿼리:
SELECT * FROM A LEFT JOIN B ON A.KEY = B.KEY
정의 :
Select tables A & B and compare key values of table A and table B and return all records of A which is in the left side of the sql query but in case of B which is in right side of sql query, only returns records that have the same key values of table A.
오른쪽 조인
SQL 쿼리:
SELECT * FROM A RIGHT JOIN B ON A.KEY = B.KEY
정의 :
Select tables A & B and compare key values of table A and table B and return all records of B which is in the right side of the sql query but in case of A which is in left side of sql query, only returns records that have the same key values of table B.
메모 :
1. ON
절은 USING
절보다 더 일반적인 절입니다. 하나의 열, 열 집합 및 조건에 대한 테이블을 조인할 수 있습니다. 예를 들어:
SELECT * FROM city JOIN country ON city.country_code = country.country_code
2. USING
는 두 테이블이 조인하는 동일한 이름의 열을 공유할 때 유용합니다. 예를 들어:
SELECT city.name, city_id FROM city JOIN country USING city_id
전체 외부 조인
SQL 쿼리:
SELECT * FROM A FULL OUTER JOIN B ON A.KEY = B.KEY
정의 :
Select tables A & B and compare key values of table A and table B and return all records of both A & B and fill in NULL for missing matches on either side.
왼쪽 외부 조인
SQL 쿼리:
SELECT * FROM A LEFT OUTER JOIN B ON A.KEY = B.KEY WHERE B.KEY IS NULL
정의 :
Left outer join returns set of records from A, with the matching records in B (which are available). If there is no match, the right side will have null.
오른쪽 외부 조인
SQL 쿼리:
SELECT * FROM A RIGHT OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL
정의 :
Right outer join returns set of records from B, with the matching records in A (which are available). If there is no match, the left side will have null.
교차 없는 전체 외부 조인
SELECT * FROM A FULL OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL OR B.KEY IS NULL
정의 :
Full outer join without intersection returns the set of records only in table A, but not in table B or the set of records only in table B, but not in table A. This clause returns all records that match the ON condition, excluding those are in common between two tables, or those records exist in both tables.
내 개인 블로그 : https://danyson.github.io/
Reference
이 문제에 관하여(SQL 조인), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/danyson/sql-joins-o3m
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
SELECT * FROM A INNER JOIN B ON A.KEY = B.KEY
Select tables A & B and compare key values of table A and table B and return records which only have the identical key values in both tables of A & B. This is similar to the Set theory operation Intersection
which is denoted by A ∩ B, the set containing all elements of A that also belong to B.
SQL 쿼리:
SELECT * FROM A LEFT JOIN B ON A.KEY = B.KEY
정의 :
Select tables A & B and compare key values of table A and table B and return all records of A which is in the left side of the sql query but in case of B which is in right side of sql query, only returns records that have the same key values of table A.
오른쪽 조인
SQL 쿼리:
SELECT * FROM A RIGHT JOIN B ON A.KEY = B.KEY
정의 :
Select tables A & B and compare key values of table A and table B and return all records of B which is in the right side of the sql query but in case of A which is in left side of sql query, only returns records that have the same key values of table B.
메모 :
1. ON
절은 USING
절보다 더 일반적인 절입니다. 하나의 열, 열 집합 및 조건에 대한 테이블을 조인할 수 있습니다. 예를 들어:
SELECT * FROM city JOIN country ON city.country_code = country.country_code
2. USING
는 두 테이블이 조인하는 동일한 이름의 열을 공유할 때 유용합니다. 예를 들어:
SELECT city.name, city_id FROM city JOIN country USING city_id
전체 외부 조인
SQL 쿼리:
SELECT * FROM A FULL OUTER JOIN B ON A.KEY = B.KEY
정의 :
Select tables A & B and compare key values of table A and table B and return all records of both A & B and fill in NULL for missing matches on either side.
왼쪽 외부 조인
SQL 쿼리:
SELECT * FROM A LEFT OUTER JOIN B ON A.KEY = B.KEY WHERE B.KEY IS NULL
정의 :
Left outer join returns set of records from A, with the matching records in B (which are available). If there is no match, the right side will have null.
오른쪽 외부 조인
SQL 쿼리:
SELECT * FROM A RIGHT OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL
정의 :
Right outer join returns set of records from B, with the matching records in A (which are available). If there is no match, the left side will have null.
교차 없는 전체 외부 조인
SELECT * FROM A FULL OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL OR B.KEY IS NULL
정의 :
Full outer join without intersection returns the set of records only in table A, but not in table B or the set of records only in table B, but not in table A. This clause returns all records that match the ON condition, excluding those are in common between two tables, or those records exist in both tables.
내 개인 블로그 : https://danyson.github.io/
Reference
이 문제에 관하여(SQL 조인), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/danyson/sql-joins-o3m
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
SELECT * FROM A RIGHT JOIN B ON A.KEY = B.KEY
Select tables A & B and compare key values of table A and table B and return all records of B which is in the right side of the sql query but in case of A which is in left side of sql query, only returns records that have the same key values of table B.
SELECT * FROM city JOIN country ON city.country_code = country.country_code
SELECT city.name, city_id FROM city JOIN country USING city_id
SQL 쿼리:
SELECT * FROM A FULL OUTER JOIN B ON A.KEY = B.KEY
정의 :
Select tables A & B and compare key values of table A and table B and return all records of both A & B and fill in NULL for missing matches on either side.
왼쪽 외부 조인
SQL 쿼리:
SELECT * FROM A LEFT OUTER JOIN B ON A.KEY = B.KEY WHERE B.KEY IS NULL
정의 :
Left outer join returns set of records from A, with the matching records in B (which are available). If there is no match, the right side will have null.
오른쪽 외부 조인
SQL 쿼리:
SELECT * FROM A RIGHT OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL
정의 :
Right outer join returns set of records from B, with the matching records in A (which are available). If there is no match, the left side will have null.
교차 없는 전체 외부 조인
SELECT * FROM A FULL OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL OR B.KEY IS NULL
정의 :
Full outer join without intersection returns the set of records only in table A, but not in table B or the set of records only in table B, but not in table A. This clause returns all records that match the ON condition, excluding those are in common between two tables, or those records exist in both tables.
내 개인 블로그 : https://danyson.github.io/
Reference
이 문제에 관하여(SQL 조인), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/danyson/sql-joins-o3m
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
SELECT * FROM A LEFT OUTER JOIN B ON A.KEY = B.KEY WHERE B.KEY IS NULL
Left outer join returns set of records from A, with the matching records in B (which are available). If there is no match, the right side will have null.
SQL 쿼리:
SELECT * FROM A RIGHT OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL
정의 :
Right outer join returns set of records from B, with the matching records in A (which are available). If there is no match, the left side will have null.
교차 없는 전체 외부 조인
SELECT * FROM A FULL OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL OR B.KEY IS NULL
정의 :
Full outer join without intersection returns the set of records only in table A, but not in table B or the set of records only in table B, but not in table A. This clause returns all records that match the ON condition, excluding those are in common between two tables, or those records exist in both tables.
내 개인 블로그 : https://danyson.github.io/
Reference
이 문제에 관하여(SQL 조인), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/danyson/sql-joins-o3m
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
SELECT * FROM A FULL OUTER JOIN B ON A.KEY = B.KEY WHERE A.KEY IS NULL OR B.KEY IS NULL
Full outer join without intersection returns the set of records only in table A, but not in table B or the set of records only in table B, but not in table A. This clause returns all records that match the ON condition, excluding those are in common between two tables, or those records exist in both tables.
Reference
이 문제에 관하여(SQL 조인), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/danyson/sql-joins-o3m텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)