中易网

我前几天面试遇到的一道数据库查询的题 要求查询这三个科目都在80分以上的人名

答案:3  悬赏:0  
解决时间 2021-02-19 08:50
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')
我前几天面试遇到的一道数据库查询的题
怎么查 求指点
最佳答案
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;
没有测试,你自己试试。
全部回答
select s.name from score s where s.subject in ('Chinese', 'English', 'manth') where s.score > 80;
我会认同(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')
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
我工资一月才三、四千,公司说要交公积金,我
我想去理发,但是又不知道理那种,求救
只含有碳氢氧的有机物有特别的称谓吗
办理商业贷款需要哪些手续?
黄金彩虹里饰演丁一宇小时候的演员是谁
一个池塘里面有2条鱼旁边有一个笼子里面有一
关于射雕英雄传及其续集的几个疑问!
土豆怎样加工成面粉
盛兴门窗装饰地址有知道的么?有点事想过去
小米5极光rom好用吗
WinTOPO的使用方法
上班路面施工造成底盘刮擦,施工方有责任么?
毓秀苗族乡地址在什么地方,想过去办事
居里夫人实验室的条件有哪些?
遗留资产如何录入SAP系统?
推荐资讯
车险自律了.平安电话车险还优惠吗
n318与nu38轴承有什么区别
独立自主是我国外交政策的基本立场。下列做法
挖泥船的价格
山西红十字口腔医院
菜鸟驿站(从化城鳌大道东店)地址有知道的么?
从贵州的红果到陕西咸阳火车站要多久
QQ密码申诉就是诈骗的罪魁祸首
下列微粒中,还原性最强的是(  ) A.F
日语莫够恰是什么意思
41除以4等于多少余5
如何检验氧气及检验氧气是否已收集满
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?