본문 바로가기
Develop/Database

[Leetcode] 175. Combine Two Tables (MySQL) 문제 및 풀이

by 초코칩프라푸치노 2021. 12. 12.

문제) Leetcode - SQL - Combine Two Tables

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

 

Person 테이블과 Address 테이블 합치면 되는 문제였습니다. Address 테이블은 존재하지 null로 처리해야되므로 left join을 이용해서 테이블을 합쳤습니다.

 

 

풀이)

select firstName, lastName, city, state
from Person left join Address on Person.personid = Address.personId
반응형

댓글