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;

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

上一篇:PG和MySQL到底选啥?


下一篇:[转]Mysql字符串截取总结:left()、right()、substring()、substring