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

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;

标签:City,join,PersonId,Person,Address,175,LeetCode,left
来源: https://www.cnblogs.com/OFSHK/p/14628173.html