LeeCode——Combine Two Tables
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
解题思路较为简单,使用left join即可解决.
答案如下图所示:
# Write your MySQL query statement below
select Person.FirstName, Person.LastName, Address.City, Address.State from Person left join Address on Person.PersonId = Address.PersonId;
PS:
如果您觉得我的文章对您有帮助,请关注我的微信公众号,谢谢!
LeeCode——Combine Two Tables的更多相关文章
- LeetCode 175 Combine Two Tables mysql,left join 难度:0
		
https://leetcode.com/problems/combine-two-tables/ Combine Two Tables Table: Person +-------------+-- ...
 - LeetCode 175. Combine Two Tables 【MySQL中连接查询on和where的区别】
		
一.题目 175. Combine Two Tables 二.分析 连接查询的时候要考虑where和on的区别 where : 查询时,连接的时候是必须严格满足条件的,满足了才会加入到临时表中. on ...
 - LeeCode(Database)-Combine Two Tables
		
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...
 - [Leetcode|SQL] Combine Two Tables
		
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...
 - [LeetCode] Combine Two Tables 联合两表
		
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...
 - [leetcode]Combine Two Tables
		
leetcode竟然有sql的题了..两道简单的应该会做 这个题主要就是一个left join... # Write your MySQL query statement below SELECT P ...
 - Leetcode 175. Combine Two Tables
		
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...
 - Combine Two Tables
		
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...
 - 175. Combine Two Tables【LeetCode】-LEFT JON 和RIGHT JOIN,两张表关联查询-java -sql入门
		
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...
 
随机推荐
- Could not resolve resource location pattern [classpath:com/****/mappers/*.xml]: class path resource [com/****/mappers/] cannot be resolved to URL because it does not exist的问题
			
这里建议先去看看路径的问题,看看application.xml的里面的导入的相应的配置文件的路径有没有问题,如下: 再者看看相应的注解有没有加上,service和controller等的注解 如果再不 ...
 - 批量bat脚本复制文件或文件夹
			
主要用于在本地下,复制文件或文件夹到当前文件夹 @echo off echo 复制文件或文件夹到当前文件夹(复制文件选择[],复制文件夹选择[]) set /p num=输入选择的数字: : set ...
 - Cooperation、Collaboration与Coordination的区别
			
Cooperation.Collaboration与Coordination的区别 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 1. Coopera ...
 - 如何在类中根据枚举值,获取枚举的message的工具类
			
枚举类为: public enum OrderStatusEnum implements CondeEnum{ NEW(0, "新订单"), FINISHED(1, "完 ...
 - day47_9_6(前端之js)
			
一.js发展. 1996年11月,JavaScript的创造者--Netscape公司,决定将JavaScript提交给国际标准化组织ECMA,希望这门语言能够成为国际标准.次年,ECMA发布262号 ...
 - 经典损失函数:交叉熵(附tensorflow)
			
每次都是看了就忘,看了就忘,从今天开始,细节开始,推一遍交叉熵. 我的第一篇CSDN,献给你们(有错欢迎指出啊). 一.什么是交叉熵 交叉熵是一个信息论中的概念,它原来是用来估算平均编码长度的.给定两 ...
 - 微信小程序之结构目录、视图层、双线程模型、生命周期、事件传递冒泡、组件、request、登录授权及支付
			
结构目录与配置介绍 视图层与基础语法 双线程模型 生命周期 事件.传递和冒泡 组件.自定义组件.组件事件传递页面 Request.路由跳转.本地存储 登录(后端实现) | 授权(后端实现) 支付(后端 ...
 - 题解 P3693 【琪露诺的冰雪小屋】
			
知识点: 模拟 , 信仰 原题面 大 型 车 万 众 自 裁 现 场 分析题意: 操作: ICE_BARRAGE R C D S R:行 , C:列, D:方向 , S:强度 在(R,C) 向 D 射 ...
 - SVN版本更新自动通知提醒
			
当其他用户提交后,如何提示我及时更新代码或版本? 一般情况下,代码的更新时间节点在每天工作开始或有重大功能提交时,所以,不是所有人都对此功能有需求,最好的方式是使用客户端"SVN项目监视器& ...
 - vue 使用localstorage实现面包屑
			
mutation.js代码: changeRoute(state, val) { let routeList = state.routeList; let isFind = false; let fi ...
 
			
		