登录
首页 >  数据库 >  MySQL

[LeetCode] Combine Two Tables

来源:SegmentFault

时间:2023-02-24 20:57:27 310浏览 收藏

本篇文章向大家介绍《[LeetCode] Combine Two Tables》,主要包括MySQL、leetcode,具有一定的参考价值,需要的朋友可以参考一下。

Problem

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.

Write a SQL query for a report that provides the following information for each person in the Person table, regardless if there is an address for each of those people:

FirstName, LastName, City, State

Solution

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

理论要掌握,实操不能落!以上关于《[LeetCode] Combine Two Tables》的详细介绍,大家都掌握了吧!如果想要继续提升自己的能力,那么就来关注golang学习网公众号吧!

声明:本文转载于:SegmentFault 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>
评论列表