20200326 连接子查询作业

本贴最后更新于 1366 天前,其中的信息可能已经时移俗易

根据老师讲的,自己整理思路(除了老师提供的,也可以是你真实遇到的面试题),将问题或答案提交到柠檬班论坛
image.png

-- 创建成绩表

   drop table if EXISTS tb_lemon_score;

   create table tb_lemon_score(
sname varchar(20),
course varchar(20),
score tinyint

);

   INSERT tb_lemon_score VALUES

('张三','语文',71),
('张三','数学',75),
('李四','语文',76),
('李四','数学',90),
('王五','语文',81),
('王五','数学',100),
('王五','英语',90);

回复形式:

1、问题+答案 或者 问题求助

2、本次系列课的心得体会,收获、建议以及评价都可以哦~~

注意:老师会评选出优秀回复+作业全勤+到课全勤,将会有大奖等着优秀的你

23 回帖
请输入回帖内容 ...
  • freeza

    image.png
    image.png

  • 其他回帖
  • zhanghang

    老师讲的第四种答案
    select * from tb_lemon_score t1 where not exist (select * from tb_lemon_score t2 where t1.sname=t2.sname and t2.score <=80)
    可以改成 select * from tb_lemon_score t1 where t1.sname not exist (select * from tb_lemon_score t2 where t2.score <=80) 吗?课堂上发不出去。。

  • che

    查询出每门课程都大于80分的学生姓名

    select sname from tb_lemon_score group by sname having MIN(score)>80;

    给出所有购入物品为两种或两种以上的购物人记录

    select 购物人 from 购物单 where 数量>=2 group by 购物人;

  • youmaobing233

    1:
    image.png

    2:
    image.png

  • 查看更多回帖