LeeCode(Database)-Combine Two Tables
2015-07-27 11:09
246 查看
Table:
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:
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
相关文章推荐
- 运行该脚本出现/bin/sh^M: bad interpreter: No such file or directory
- 很好的客户端后台博客
- 【MYSQL】导入中文后乱码问题
- 使用fiddler修改请求和响应
- 如何在Eclipse中查看Java类库的源代码以及相应的api
- 获取手机屏幕的宽高
- 认识与入门 Markdown
- 图灵机器人
- 修改Xcode显示行号&缩进距离
- 欢迎使用CSDN-markdown编辑器
- HDOJ 2000 ASCII码排序(水题)(多方法)
- 虚拟机安装Oracle 11g并远程连接
- Word公式字体乱码终极解决(BY 冷家锋)
- 杭电 2032 杨辉三角
- log4j使用心得
- 杭电dp60题
- CSU 1104 盒子游戏
- NSArray排序方法
- Lightoj 1122 - Digit Count 【DP】
- nyoj 括号匹配问题(栈的应用)