首页 > 其他 > 详细

leetcode175 组合两个表 Combine Two Tables

时间:2019-10-22 21:49:26      阅读:106      评论:0      收藏:0      [点我收藏+]

技术分享图片

创建表和数据:

drop table Person; 
Create table Person (PersonId int,FirstName varchar(255), LastName varchar(255));

drop table Address;
Create table Address (AddressId int,PersonId int, City varchar(255), State varchar(255));

insert into Person (PersonId, LastName,FirstName) values (1, Wang, Allen);

insert into Address (AddressId, PersonId,City, State) values (1, 2, New York City, New York);

 

解法:

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

 

leetcode175 组合两个表 Combine Two Tables

原文:https://www.cnblogs.com/forever-fortunate/p/11722386.html

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!