题目 select FirstName, LastName, City, State from Person left join Addressusing (PersonId); or select FirstName, LastName, City, State from Person left join Addresson Person.PersonId=Address.PersonI
题目描述:有如下两个表Table和Address,请选择FirstName, LastName, City, State这几个属性出来,不管Address中的属性是否存在; 解题思路:这是一道简单的SQL语句题目,选出两个表中的FirstName, LastName, City, State这几列,根据题意可知使用left join可实现,有关各类join的解析,请看博客SQL-JOIN。
SQL实现 # Write your MySQL query statement below# 姓、名、城市和州,即last name, first name, City, StateSELECT FirstName, LastName, City, StateFROM Person left join AddressON Person.PersonId = Address.PersonI
1. 原题 https://leetcode.com/problems/combine-two-tables/ 2. 思路 查询表中数据,使用外联结即可。 3. 源码 # Write your MySQL query statement belowSELECT pe.FirstName, pe.LastName, ad.City, ad.StateFROM Person AS pe