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
 SELECT Person.FirstName,Person.LastName,Address.City,Address.State
FROM Person
Left JOIN Address
ON Person.PersonId=Address.PersonId

LeeCode(Database)-Combine Two Tables的更多相关文章

  1. LeetCode 175 Combine Two Tables mysql,left join 难度:0

    https://leetcode.com/problems/combine-two-tables/ Combine Two Tables Table: Person +-------------+-- ...

  2. LeetCode 175. Combine Two Tables 【MySQL中连接查询on和where的区别】

    一.题目 175. Combine Two Tables 二.分析 连接查询的时候要考虑where和on的区别 where : 查询时,连接的时候是必须严格满足条件的,满足了才会加入到临时表中. on ...

  3. LeeCode——Combine Two Tables

    Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...

  4. [Leetcode|SQL] Combine Two Tables

    Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...

  5. LeeCode(Database)-Customers Who Never Order

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

  6. leetcode 175 Combine Two Tables join用法

    https://leetcode.com/problemset/database/ ACM退役,刚好要学sql,一定要刷题才行,leetcode吧. 这一题,说了两个表,一个左一个右吧,左边的pers ...

  7. [LeetCode] Combine Two Tables 联合两表

    Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...

  8. [leetcode]Combine Two Tables

    leetcode竟然有sql的题了..两道简单的应该会做 这个题主要就是一个left join... # Write your MySQL query statement below SELECT P ...

  9. LeeCode(Database)-Duplicate Emails

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

随机推荐

  1. Quartus DSE 初步应用

    介绍 Design Space Explorer (DSE) is a program that automates the process of finding the optimal collec ...

  2. QQ聊天界面的布局和设计(IOS篇)-第一季

    我写的源文件整个工程会再第二季中发上来~,存在百度网盘, 感兴趣的童鞋, 可以关注我的博客更新,到时自己去下载~.喵~~~ QQChat Layout - 第一季 一.准备工作 1.将假数据messa ...

  3. 格而知之16:我所理解的Block(2)

    11.那么Block到底是怎么实现的呢?试一试通过将Block 的代码转换成普通C语言代码来查看它的实现过程. 要将OC代码转换成C语言代码,可以使用clang编译的一个命令: 通过这个命令能把指定文 ...

  4. Qwerty78 Trip(组合数,规律,逆元)

    Qwerty78 Trip time limit per test 2 seconds memory limit per test 64 megabytes input standard input ...

  5. ABAP - 日期格式转换 & ABAP经常使用日期处理函数

    ABAP - 日期格式转换 如今提供下面一些日期格式转换的函数: Below are several FMs which can be used to convert date format. 1. ...

  6. zXing使用小结

    在android上二维码.条形码扫描,google官方为我们提供了zXing,几乎android涉及到扫描的都是用这个开源项目实现的,也有在android上使用zBar的,和其他用过的交流得知zBar ...

  7. IDataParameter调用存储过程

    public string  GenerateExamePaper(string paperType, string driverID, string MacAddr)         {       ...

  8. Android应用程序进程启动过程的源代码分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址: http://blog.csdn.net/luoshengyang/article/details/6747696 Android 应用程序框架层创 ...

  9. 我对 javascript 闭包的理解

    学js的学到闭包,但是理解不深. 后来看了一下这篇文章: 地址:http://leepiao.blog.163.com/blog/static/4850313020112835355917/ 内容如下 ...

  10. JS滚轮事件(mousewheel/DOMMouseScroll)了解

    已经没有了小学生时代过目不忘的记忆力了,很多自己折腾的东西.接触的东西,短短1年之后就全然不记得了.比方说,完全记不得获取元素与页面距离的方法(getBoundingClientRect),或者是不记 ...