由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - sql面试题目求指点
相关主题
关于Acess的简单问题请教一个ACCESS的土问题
问一道sql的面试题啊 自己实在是没想出来Re: 求教: Join 两个query (data) tables 出错
怎么写这个Query,谢谢菜鸟求教 MS Access pass through query
这个问题的sql query为什么这样写?如果比较两个table?再access里边
a complex sql query, high hand help!!!有没有可能将在Access里做好的东西导入到Oracle里去
What is optimizer statistics of a table and what is access plan of a query请教一个SQL Query
请教ACCESS问题, 如何把REPORT的结果(如SUM)写回TABLE中?help on this query
如何完成这个sql?我也问一个sql querry的问题
相关话题的讨论汇总
话题: employee话题: salary话题: department话题: table话题: e1
进入Database版参与讨论
1 (共1页)
h*******m
发帖数: 39
1
一道面试题,第一个table employee,第二个table department. 现在要用sql找出每一
个department里工资最高的人。答案在后面可我看不懂那个e1.name as employee是啥
意思?e2又是从哪冒出来的? 谢谢啦
employee
+----+-------+--------+--------------+
| Id | Name | Salary | DepartmentId |
+----+-------+--------+--------------+
| 1 | Joe | 70000 | 1 |
| 2 | Henry | 80000 | 2 |
| 3 | Sam | 60000 | 2 |
| 4 | Max | 90000 | 1 |
+----+-------+--------+--------------+
department
+----+----------+
| Id | Name |
+----+----------+
| 1 | IT |
| 2 | Sales |
+----+----------+
select Department.Name as Department, e1.Name as Employee, Salary
from Employee e1, Department
where e1.DepartmentId = Department.Id
and
Salary >= ALL (select Salary from Employee e2 where e2.DepartmentId = e1.
DepartmentId);
x****e
发帖数: 1773
2
Check correlated subqueries.

【在 h*******m 的大作中提到】
: 一道面试题,第一个table employee,第二个table department. 现在要用sql找出每一
: 个department里工资最高的人。答案在后面可我看不懂那个e1.name as employee是啥
: 意思?e2又是从哪冒出来的? 谢谢啦
: employee
: +----+-------+--------+--------------+
: | Id | Name | Salary | DepartmentId |
: +----+-------+--------+--------------+
: | 1 | Joe | 70000 | 1 |
: | 2 | Henry | 80000 | 2 |
: | 3 | Sam | 60000 | 2 |

h*******m
发帖数: 39
3
Thank you.
j********5
发帖数: 281
4
1,from Employee e1---here rename table employee in first query as e1 table,
2,ALL (select Salary from Employee e2---here rename the same table employee
in 2nd query as e2 table,
usually in this way, you can distinguish same table(employee) from different
queries, in order to prevent confusion.
j********5
发帖数: 281
5
1,from Employee e1---here rename table employee in first query as e1 table,
2,ALL (select Salary from Employee e2---here rename the same table employee
in 2nd query as e2 table,
usually in this way, you can distinguish same table(employee) from different
queries, in order to prevent confusion.
1 (共1页)
进入Database版参与讨论
相关主题
我也问一个sql querry的问题a complex sql query, high hand help!!!
HELP: 如何实现 一个简单的QueryWhat is optimizer statistics of a table and what is access plan of a query
请教一个query in mysql请教ACCESS问题, 如何把REPORT的结果(如SUM)写回TABLE中?
sql query question如何完成这个sql?
关于Acess的简单问题请教一个ACCESS的土问题
问一道sql的面试题啊 自己实在是没想出来Re: 求教: Join 两个query (data) tables 出错
怎么写这个Query,谢谢菜鸟求教 MS Access pass through query
这个问题的sql query为什么这样写?如果比较两个table?再access里边
相关话题的讨论汇总
话题: employee话题: salary话题: department话题: table话题: e1