layout | title | description | date | categories | comments |
---|---|---|---|---|---|
post |
[LeetCode 175] Combine Two Tables |
[LeetCode 175] Combine Two Tables |
2020-03-12 13:40:00 -0700 |
Algorithm |
true |
[LeetCode 175] Combine Two Tables
두 테이블이 주어졌을 때, 두 테이블을 조인한 결과를 구하는 SQL 문제
각 사람 별로 주소가 있는지 여부에 관계없이 조인하는 문제이므로, Person이 왼쪽에 있다는 기준으로 LEFT OUTER JOIN을 해주면 된다.
# Write your MySQL query statement below
select FirstName, LastName, City, State
from Person
left outer join Address
on Person.PersonId = Address.PersonId;