美文网首页
五十道MySql 自己的答案

五十道MySql 自己的答案

作者: 大俗XD_ | 来源:发表于2019-02-23 16:15 被阅读0次
1.1
select * from (select SId,score from sc where CId='01') as t1 ,(select SId,score from sc where CId='02') as t2 where t1.score>t2.score and t1.SId=t2.Sid;
1.2
select * from (select * from sc where CId='01') as t1,(select * from sc where CId='02') as t2 where t1.SId=t2.SId;
1.3
select * from (select * from sc where CId='01') as t1 left join (select * from sc where CId='02') as t2 on t1.SId=t2.SId;
1.4
select * from sc where sc.SId not in (select SId from sc where CId='01')  and sc.CId='02';
2
select student.SId,student.Sname,student.Sage,student.Ssex,t1.averge from (select SId,SUM(score)/COUNT(CId) as averge from sc group by SId) as t1,student where t1.SId=student.SId and t1.averge>=60;
3
select student.SId,student.Sname,student.Sage,student.Ssex from student where student.SId in (select sc.SId from sc);
4
select student.SId ,student.Sname,t1.scoreAll,t1.CouseCount from Student left join (select sc.SId as StuId,COUNT(sc.CId) as CouseCount,SUM(sc.score) as scoreAll from SC group by sc.SId) as t1 on student.SId=t1.StuId;
4.1
select student.SId ,student.Sname,t1.scoreAll,t1.CouseCount from Student , (select sc.SId as StuId,COUNT(sc.CId) as CouseCount,SUM(sc.score) as scoreAll from SC group by sc.SId) as t1 where student.SId=t1.StuId;
5
select COUNT(teacher.Tname) from Teacher where teacher.Tname like '李%';
6
select student.* from Student,sc,
(select CId from Course,
    (select TId from teacher where Teacher.Tname='张三') as t2
    where course.TId=t2.TId) as t3 where sc.CId=t3.CId and  sc.SId=Student.SId;
7
select student.* from student,(select allScoreSId,count(CId) as courseCount from (select student.SID as allScoreSId,sc.CId from student left join sc on student.SId=sc.SId) as allScore group by allScore.allScoreSId) as t1 where student.SId=t1.allScoreSId and t1.courseCount<3;

相关文章

  • 五十道MySql 自己的答案

  • es6的promise面试题【整理】

    十道es6的Promise面试题,附答案 http://www.bslxx.com/a/mianshiti/tik...

  • 2018-05-21

    国家公务员考试要求十五分钟做完这十五道题,作为一名智商正常的前数学爱好者,李某人没看答案之前会做十道,做完这十道花...

  • 挑战答题

    做过学习强国挑战答题的人都知道,每天挑战答对五道题、十道题的不算难事,可是每天挑战答题答对二十道以上就不太容易了,...

  • 十道简单的前端面试题

    以下十道题是我初学前端过程中进行自我检测的题目,其中答案均是我自己写的不能保证完全正确,仅供各位查看。如果有发现错...

  • 亲子日记第75篇

    今天欣宝口算题作了六十道,自己检查出两道错题,进步很大以前自己检查不出来,利用假期叫她自己检查错题,六十道口算题错...

  • mysql45答案

    mysql45 练习答案 记录一下自己对题目的理解思路还有做法-- mysql45练习数据数据表--1.学生表 S...

  • 法考生日记8

    听课半天,错题三十道,做题四十道。不成了,头晕脑胀。 错题看的云山雾罩,再一次怀疑自己。我为什么要考试?我考下来有...

  • MySQL与Redis

    MySQL常见面试题及答案 1.MySQL的索引(索引的结构) 2.MySQL的事务 3.事务的隔离级别 4.My...

  • 五十道幽默智力题(后面有答案)

    1、什么动物最没有方向感? 2、什么动物猜拳永远不会有输赢? 3、什么动物最容易摔倒? 4、什么鸡没有翅膀? 5、...

网友评论

      本文标题:五十道MySql 自己的答案

      本文链接:https://www.haomeiwen.com/subject/chepyqtx.html