create table score
(
id int identity(1,1) primary key,
name varchar(20) not null,
subject varchar(20) not null,
score varchar(20) not null
)
go
insert into score
values('smmoth criminal','manth','89')
insert into score
values('smmoth criminal','English','83')
insert into score
values('smmoth criminal','Chinese','78')
insert into score
values('dangerous','manth','79')
insert into score
values('dangerous','English','95')
insert into score
values('dangerous','Chinese','81')
insert into score
values('billie jean','manth','85')
insert into score
values('billie jean','English','86')
insert into score
values('dangerous','Chinese','87')
我前几天面试遇到的一道数据库查询的题
怎么查 求指点
我前几天面试遇到的一道数据库查询的题 要求查询这三个科目都在80分以上的人名
答案:3 悬赏:0
解决时间 2021-02-19 08:50
- 提问者网友:血樱陌殇
- 2021-02-18 23:28
最佳答案
- 二级知识专家网友:你好陌生人
- 2021-02-19 00:50
select s.name, count(score) as total from score s where s.name in (select s.name from score s where s.subject in ('Chinese', 'English', 'manth')
where s.score > 80)
group by s.name
having total=3;
没有测试,你自己试试。
where s.score > 80)
group by s.name
having total=3;
没有测试,你自己试试。
全部回答
- 1楼网友:专属的偏见
- 2021-02-19 02:53
select s.name from score s where s.subject in ('Chinese', 'English', 'manth')
where s.score > 80;
- 2楼网友:為→妳鎖鈊
- 2021-02-19 01:36
我会认同(1 , 1)主键,
名称(20)不空,
学科分布(20)不空,
评分分布(20)不空
)
去
插入评分
值('smmothcriminal','manth','89')
插入评分
值('smmothcriminal','english','83')
插入评分
值('smmothcriminal','chinese','78')
插入评分
值('dangerous','manth','79')
插入评分
值('dangerous','english','95')
插入评分
值('dangerous','chinese','81')
插入评分
值('billiejean','manth','85')
插入评分
值('billiejean','english','86')
插入评分
值('dangerous','chinese','87')
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯