LeetCode数据库175 - 组合两个表 - left join + on的用法

题目链接

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

题解

看LeetCode上的就行,很详细也有扩充。

AC代码

select FirstName, LastName, City, State
from Person left join Address
on Person.PersonId = Address.PersonId;

或者:(这个要慢11ms)

select FirstName, LastName, City, State
from Person as p
left join Address as a
on p.PersonId = a.PersonId;
上一篇:oracle中declare程序块用法


下一篇:leetcode、mysql 175. 组合两个表