Table: Person (表:人)
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| PersonId | int |
| FirstName | varchar |
| LastName | varchar |
+-------------+---------+
PersonId
is the primary key column for this table.
(PersonId
是此表的主键列。)
Table: Address (表:地址)
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| AddressId | int |
| PersonId | int |
| City | varchar |
| State | varchar |
+-------------+---------+
AddressId
is the primary key column for this table.
(AddressId
是此表的主键列。)
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:
(为报表编写一个SQL查询,该报表将为Person
表中的每个人提供以下信息,而不管每个人是否都有地址:)
FirstName, LastName, City, State
So this is a pretty straight forward question and my answer is
(所以这是一个非常简单的问题,我的答案是)
select p.FirstName,p.LastName, a.City, a.State
from Person p , Address a
where p.PersonId = a.PersonId
And I'm not getting anything in the output and yes I filled up the tables with some simple lines of data.
(而且我没有在输出中得到任何东西,是的,我用一些简单的数据行填充了表。)
ask by fairy translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…