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. Textarea - 百度富文本编辑器插件UEditor

    UEditor各种实例演示 Ueditor 是百度推出的一款开源在线 HTML 编辑器. 主要特点: 轻量级:代码精简,加载迅速. 定制化:全新的分层理念,满足多元化的需求.采用三层架构:1. 核心层 ...

  2. easyhadoop初识以及各种问题

    版本:easyhadoop 1.2.1,操作系统:Centos 6.4: 首先,我要说的是要用对版本,这点很重要.我使用ubuntu12.04 64bit 的虚拟机是不行的,安装直接报错.所以就下载了 ...

  3. java 集合专练

    handsomecui的blog地址为:http://www.cnblogs.com/handsomecui/ 本人网站为:handsomecui.top 引言:本次主要练习单列集合:Collecti ...

  4. [转]轻量级 Java Web 框架架构设计

    工作闲暇之余,我想设计并开发一款轻量级 Java Web 框架,看看能否取代目前最为流行的而又越来越重的 Spring.Hibernate 等框架.请原谅在下的大胆行为与不自量力,本人不是为了重造轮子 ...

  5. swift中的传值

    光阴似箭,日月如梭,转眼间学习的旅途已经过了一大半了,忘着自己所敲过的成批的代码,看着自己付出和努力,默默地为自己这几个月的奋斗感到欣慰,不论学习的路途再怎么的艰辛,但是自己还是坚持过来了,回想着以往 ...

  6. [HeadFirst-HTMLCSS入门][第九章盒模式]

    新属性 line-height 行间距 line-height: 1.6em; border 边框 属性值 solid 实线 double 双实线 groove 一个槽 outset 外凸 inset ...

  7. JSP基础学习(二)

    1.JSP页面的内容组成 静态部分:标准的HTML标签.静态的页面内容,这些内容与静态的HTML页面相同 动态部分:这些由java程序来动态生成 2.<% out.println(new jav ...

  8. SQLSERVER执行时间统计工具SQLQueryStress

    有时候需要检测一下SQL语句的执行时间,相信大家都会用SET STATISTICS TIME ON开关打开SQLSERVER内置的时间统计 SET STATISTICS TIME ON 不过这款小工具 ...

  9. 转: 向tabControl中添加一个Form(C#)

  10. uva 1597 Searching the Web

    The word "search engine" may not be strange to you. Generally speaking, a search engine se ...