LeetCode關於資料庫的題目
這個嘛,原來LeetCode有題目分類欸!?!?!?!
-___-
https://leetcode.com/problems/combine-two-tables/
Table: Person
+-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId | int | | FirstName | varchar | | LastName | varchar | +-------------+---------+ PersonId is the primary key column for this table.
Table: Address
+-------------+---------+ | Column Name | Type | +-------------+---------+ | AddressId | int | | PersonId | int | | City | varchar | | State | varchar | +-------------+---------+ AddressId is the primary key column for this table.
就是合併兩個Table啦~
透過PersonID進行Left Join就好了
select
a.FirstName,a.LastName,b.City,b.State
from
Person as a left join
Address as b on a.PersonID = b.PersonID
果然做做簡單題目比較不會受挫
單純筆記,皆為非正規作法,旁門左道,胡搞瞎搞。