Leetcode 175. Combine Two Tables
来源:互联网 发布:linux proccess port 编辑:程序博客网 时间:2024/04/29 08:02
175. Combine Two Tables
Total Accepted: 25227 Total Submissions: 73988 Difficulty: EasyTable: 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
本弱渣博主准备开始进军leetcode的数据库内容,主要是题目做的太无聊了,并且没有面试光刷题并没有什么卵用。大牛从名校出来,高GPA,项目牛逼就拿面试了,然后随便刷个题就拿offer了,弱渣项目没有简历关都过不了,刷300题也觉得性价比不高啊
思路:
有俩表,需要把俩表的信息整合,用join。因为是regardless of address所以是left join。也就是左表每一行的信息加右边对应同personId的行信息。
# Write your MySQL query statement belowselect a.FirstName, a.LastName, b.City, b.State from Person a left join Address bon a.personid = b.personid;
0 0
- LeetCode : 175. Combine Two Tables
- leetcode 175. Combine Two Tables
- leetcode.175. Combine Two Tables
- leetcode 175. Combine Two Tables
- Leetcode 175. Combine Two Tables
- leetcode 175. Combine Two Tables
- 【LeetCode】175. Combine Two Tables
- [LeetCode] 175. Combine Two Tables
- leetcode 175. Combine Two Tables
- leetcode 175. Combine Two Tables
- Combine Two Tables Leetcode
- Leetcode: Combine Two Tables
- [LeetCode]Combine Two Tables
- LeetCode Combine Two Tables
- 【Leetcode】Combine Two Tables
- leetcode 175. Combine Two Tables left join
- 【leetcode Database】175.Combine Two Tables
- 175. Combine Two Tables
- Spring核心技术(五)——Spring中Bean的作用域
- 转岗,你要明白......
- 胃 癌 治疗 药方
- Java - static
- nginx切割字符串、泛域名、kong、转发代理
- Leetcode 175. Combine Two Tables
- USB相关知识
- 整数除法(除以2的幂, 除以非2的幂)
- Leetcode 176. Second Highest Salary
- 吴翰清的一封邮件(来自知乎)
- iOS开发:[!] You need to register a session first.
- Struts2运行流程
- Windows系统 为 QT5软件 搭建 OpenCV2 开发环境
- MySQL字符集和乱码问题初探