由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Quant版 - 请教一道面试题啊!关于SQL的!
相关主题
SQL find distinct values in large table (转载)error of executing SQL query of string concatenation
SQL combine two columns from two different tables no shared (转载)[合集] WorldQuant phone interview
compare two large tables SQL (转载)[合集] 继续作贡献,一道积分题。
SQL multiply all values of a column in table EXCEL VBA in real world
SQL select one value column for each distinct value another (转载)A hedge fund interview questions (CS)
SQL add some columns into a table from another table (转载C++: how to dynamically allocate a 2-D array
SQL fast search in a 10 million records table (转载)Excel VBA help!!!
How to write this query in Oracle?[合集] Interview question for Quant to share-1, please discuss and
相关话题的讨论汇总
话题: varchar话题: person话题: address话题: column话题: table
进入Quant版参与讨论
1 (共1页)
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

1 (共1页)
进入Quant版参与讨论
相关主题
[合集] Interview question for Quant to share-1, please discuss andSQL select one value column for each distinct value another (转载)
vb/excel 问题, 急!SQL add some columns into a table from another table (转载
另一道陈题SQL fast search in a 10 million records table (转载)
问一个线性回归的问题,其实就是一个代数问题How to write this query in Oracle?
SQL find distinct values in large table (转载)error of executing SQL query of string concatenation
SQL combine two columns from two different tables no shared (转载)[合集] WorldQuant phone interview
compare two large tables SQL (转载)[合集] 继续作贡献,一道积分题。
SQL multiply all values of a column in table EXCEL VBA in real world
相关话题的讨论汇总
话题: varchar话题: person话题: address话题: column话题: table