设为首页 加入收藏

TOP

一道oracle面试题
2014-11-24 01:01:21 来源: 作者: 【 】 浏览:6
Tags:一道 oracle 试题

客户表a(id name address) 登陆流水表b(id time) 购物流水表c(id time productid productnum)
1.求每个客户的最新登陆时间time姓名name客户id
2.查最新登陆并且已经购买商品的客户idname登陆的时间time(一条sql语句)


一个表student中有班级classid学号id成绩grade
1.计算各个班的平均成绩
2.查找比该班平均成绩高的学生的班级classid学号id成绩grade

1.求每个客户的最新登陆时间time姓名name客户id
select a.ida.named.time as time
from a left join (select idmax(time) as time from b group by id) d
on a.id =d.id ;
2.查最新登陆并且已经购买商品的客户idname登陆的时间time(一条sql语句)
select a.ida.named.time as time
from a(select idmax(time) as time from b group by id) d
where a.id =d.id
and exists (select * from c where id = a.id);
1.计算各个班的平均成绩
select classidavg(grade)
from student
group by classid;
2.查找比该班平均成绩高的学生的班级classid学号id成绩grade
select a.classida.ida.grade
from student a
where a.grade >(select avg(grade) from student where classid = a.classid);


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇试试一个算法推理面试题 下一篇“What does the ThreadStatic at..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: