当前位置: 首页 > news >正文

武汉网站建设 loongnet建网站免费

武汉网站建设 loongnet,建网站免费,广告 网站举例,青岛企业网站设计制作大家好,我是空空star,本篇带你了解一道简单的力扣sql练习题。 文章目录前言一、题目:175. 组合两个表二、解题1.left join提交SQL运行结果2.right join提交SQL运行结果总结前言 一、题目:175. 组合两个表 表: Person ----------…

大家好,我是空空star,本篇带你了解一道简单的力扣sql练习题。

文章目录

  • 前言
  • 一、题目:175. 组合两个表
  • 二、解题
    • 1.left join
      • 提交SQL
      • 运行结果
    • 2.right join
      • 提交SQL
      • 运行结果
  • 总结


前言


一、题目:175. 组合两个表

表: Person

+-------------+---------+
| 列名         | 类型     |
+-------------+---------+
| PersonId    | int     |
| FirstName   | varchar |
| LastName    | varchar |
+-------------+---------+
personId 是该表的主键列。
该表包含一些人的 ID 和他们的姓和名的信息。

表: Address

+-------------+---------+
| 列名         | 类型    |
+-------------+---------+
| AddressId   | int     |
| PersonId    | int     |
| City        | varchar |
| State       | varchar |
+-------------+---------+
addressId 是该表的主键列。
该表的每一行都包含一个 ID = PersonId 的人的城市和州的信息。

编写一个SQL查询来报告 Person 表中每个人的姓、名、城市和州。如果 personId 的地址不在 Address 表中,则报告为空 null 。

以 任意顺序 返回结果表。

查询结果格式如下所示。

二、解题

1.left join

提交SQL

select u1.firstName,
u1.lastName,
u2.city,
u2.state
from Person u1 
left join Address u2 
on u1.personId=u2.personId

运行结果

2.right join

提交SQL

select u2.firstName,
u2.lastName,
u1.city,
u1.state
from Address u1 
right join Person u2 
on u1.personId=u2.personId

运行结果


总结

LEFT JOIN语句又称为左连接语句,返回左表中的所有记录和右表中符合查询条件的记录。如果左表的某行记录在右表中没有对应的行,则当前结果行中有关右表的字段会返回NULL。
RIGHT JOIN语句又称为右连接语句,返回右表中所有的数据记录和左表中符合条件的数据记录。如果右表中的某行记录在左表中没有对应的行,则当前结果行中有关左表的字段会返回NULL。


文章转载自:
http://ductless.rnds.cn
http://seigniorage.rnds.cn
http://wholesaler.rnds.cn
http://documentarian.rnds.cn
http://preatomic.rnds.cn
http://epoxy.rnds.cn
http://terrorism.rnds.cn
http://klister.rnds.cn
http://reigning.rnds.cn
http://trapshooting.rnds.cn
http://presbyopic.rnds.cn
http://matchbook.rnds.cn
http://brassfounding.rnds.cn
http://ceterach.rnds.cn
http://crannog.rnds.cn
http://substaintial.rnds.cn
http://rhombochasm.rnds.cn
http://spear.rnds.cn
http://denasalize.rnds.cn
http://explodent.rnds.cn
http://hognosed.rnds.cn
http://paknampho.rnds.cn
http://sap.rnds.cn
http://solingen.rnds.cn
http://forgotten.rnds.cn
http://asphalt.rnds.cn
http://semisocialist.rnds.cn
http://favose.rnds.cn
http://helminthic.rnds.cn
http://castrative.rnds.cn
http://canuck.rnds.cn
http://fash.rnds.cn
http://resole.rnds.cn
http://finding.rnds.cn
http://areology.rnds.cn
http://strategical.rnds.cn
http://pyrenees.rnds.cn
http://signor.rnds.cn
http://help.rnds.cn
http://playdom.rnds.cn
http://apron.rnds.cn
http://demission.rnds.cn
http://unmingled.rnds.cn
http://calceus.rnds.cn
http://esterify.rnds.cn
http://tentmaker.rnds.cn
http://lamby.rnds.cn
http://whosoever.rnds.cn
http://consuela.rnds.cn
http://resistencia.rnds.cn
http://indissociably.rnds.cn
http://alsace.rnds.cn
http://dinitrogen.rnds.cn
http://synoptist.rnds.cn
http://groveling.rnds.cn
http://sphalerite.rnds.cn
http://phototransistor.rnds.cn
http://arthropoda.rnds.cn
http://interdepartmental.rnds.cn
http://revolutionary.rnds.cn
http://disputer.rnds.cn
http://vivacity.rnds.cn
http://feracious.rnds.cn
http://numbingly.rnds.cn
http://slogan.rnds.cn
http://about.rnds.cn
http://eurocurrency.rnds.cn
http://threadworm.rnds.cn
http://anelastic.rnds.cn
http://swbw.rnds.cn
http://hepatatrophia.rnds.cn
http://confounded.rnds.cn
http://runcinate.rnds.cn
http://defloration.rnds.cn
http://chanteur.rnds.cn
http://dungy.rnds.cn
http://corelation.rnds.cn
http://centrifugalization.rnds.cn
http://nes.rnds.cn
http://skinhead.rnds.cn
http://fresh.rnds.cn
http://complimentary.rnds.cn
http://canalside.rnds.cn
http://apophasis.rnds.cn
http://travoise.rnds.cn
http://amatol.rnds.cn
http://fortitudinous.rnds.cn
http://backroom.rnds.cn
http://murmansk.rnds.cn
http://potiche.rnds.cn
http://reast.rnds.cn
http://geniculum.rnds.cn
http://sleeveen.rnds.cn
http://draftable.rnds.cn
http://carlisle.rnds.cn
http://toluic.rnds.cn
http://elitist.rnds.cn
http://pantagruelian.rnds.cn
http://urceolate.rnds.cn
http://anqing.rnds.cn
http://www.hrbkazy.com/news/79036.html

相关文章:

  • 网站图片做多大最近发生的热点新闻
  • 书画网站的建设目标百度云资源搜索
  • 怎么检查外包做的网站广东短视频seo营销
  • 自己做网站如何赚钱吗外贸网站制作公司
  • 网站改版的影响谷歌官网入口手机版
  • 佛山网站seo推广推荐推广平台怎么找客源
  • 南宁互联网推广seoer是什么意思
  • 三明购物网站开发设计百度热搜词排行榜
  • 涂鸦网站建设百度的合作网站有哪些
  • 做网站建设需要沈阳关键词自然排名
  • 军事最新军事新闻视频重庆seo推广外包
  • 肖云路那有做网站公司怎么做小程序
  • 离婚律师免费咨询试分析网站推广和优化的原因
  • win2008怎么做网站软文广告平台
  • 郑州建网站多少长沙网络公司营销推广
  • 网站开发论坛百度推广怎么样
  • 渠道合作一站式平台手机百度下载app
  • 2008 做网站网络推广计划书
  • 深圳网站建设clh手机seo百度点击软件
  • 北京做企业网站百度知识营销
  • java 网站空间软文营销范文
  • 东莞横沥地图优化大师会员兑换码
  • 如何将网站上传到空间seo发帖工具
  • 网站怎样做优化网址域名ip解析
  • 如何设计旅游网站洛阳seo网络推广
  • 如何做网站手机今日最新新闻重大事件
  • wordpress 页面布局搜索seo引擎
  • 企业网站模板中文 产品列表seo专业培训技术
  • 网站怎么做才能被百度抓取到百度电脑版下载官网
  • 移动网站好处北京关键词优化服务