y******8 发帖数: 40 | 1 Table: Person
Columns
Column Name Type Nullable
person_ID int No
FirstName varchar No
MidleName varchar Yes
LastName varchar No
Person_ID is the primary key column for this table.
Columns
Column Name Type Nullable
Address_ID int No
person_ID int No
StreetNumber varchar No
StreetName varchar No
City varchar No
State varchar No
Address_ID 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 | d*j 发帖数: 13780 | 2 select p.FirstName, p.LastName, a.City, a.State
from person as p, address as a
where p.person_ID = a.person_ID | c****o 发帖数: 1280 | 3 I think you need to join these two tables
select p.FirstName, p.LastName, a.City, a.State
from person as p, address as a
from person JOIN address, ON p.person_ID = a.person_ID
【在 d*j 的大作中提到】 : select p.FirstName, p.LastName, a.City, a.State : from person as p, address as a : where p.person_ID = a.person_ID
| c******n 发帖数: 49 | 4 Need a left join.
....
where p.person_ID = a.person_ID(+)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
【在 d*j 的大作中提到】 : select p.FirstName, p.LastName, a.City, a.State : from person as p, address as a : where p.person_ID = a.person_ID
|
|