LeetCode #175组合两个表

https://leetcode-cn.com/problemset/database/

满足条件:无论 person 是否有地址信息,都需要基于上述两表提供 person 信息。

这个条件刚好满足左连接的概念,获取person表所有记录,即使address表没有对应匹配的记录。所以直接用左连接联合两个表进行查询。

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

猜你喜欢

转载自blog.csdn.net/a912952381/article/details/80731957