728x90

https://leetcode.com/problems/combine-two-tables/

 

Combine Two Tables - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

[problem]

두 테이블간의 join 필요

Write an SQL query to report the first name, last name, city, and state of each person in the Person table. If the address of a personId is not present in the Address table, report null instead.

Return the result table in any order.

[analysis]

1. address가 null인 경우도 정보를 보여줘야 하므로 person table 기준으로 left join 실행

2. 두 테이블에 공통 컬럼인 personId 기준으로 join

 

[solution]

728x90

+ Recent posts