dkfr.net
当前位置:首页 >> 求帮忙写两段sql语句 >>

求帮忙写两段sql语句

1 select stdname,stdclass from 表名 where stdgrade=(select max(stdgrade) from 表名) 2 select top 1 t.stdclassfrom(select stdclass,avg(stdgrade) avg_stdgrade from 表名 group by stdclass) torder by t.avg_stdgrade desc表名自己替换

--最后一个应该是排列组合问题吧站发=2*1+5*4*3*2*1=122种--第一个问题要给出交易日期的字段类型--第二个问题答案如下select top(10) * from (select p.pn产品名称,a.总交易额 from (select p#产品编号,sum(g交易金额) 总交易额 from t group by...

你提供的信息不完整让人咋写? 写详细点! 无非就是连接查询

CREATE FUNCTION float sf_getAverageGrade(@sname nchar(10)) RETURNS int AS RETURN ( WITH leaderCTE as( SELECT id, name,manager FROM [lulinghao].[dbo].[YGB] WHERE name = @name UNION ALL SELECT ygb.id, ygb.name,ygb.manager FRO...

select chehao, sum(kaoshizong) as 总人数,sum(kaoshiguo) as 通过人数 ,round(sum(kaoshiguo)/sum(kaoshizong)*100,2) as 百分比 from kaoshidui group by chehao --如果是sql2008,那么要给被除数加小数位,否则结果小于0时,只显示0 --以下...

1 select * from s where not exists (select 1 from sc where sc.sno = s.sno and sc.cno = 5); 2 select * from s where exists(select * from sc where sc.sno = s.sno group by sno having count(1) = (select count(1) from c)); 3 select ...

select * from stu where id=‘123’ and name=‘你好’and college=‘上中’and status=‘232’

order by * desc, * acs ; *为条件,条件的优先级和条件的先后顺序一致

UPDATE SC SET Grade=Grade+10 WHERE Cid='C1' GO UPDATE SC SET Grade=Grade+5 WHERE Cid=(SELECT Cid FROM Course WHERE Cname='database') AND Sid IN(SELECT Sid FROM Student WHERE Sdept='CS') GO UPDATE Student SET age=age+3 WHRE Sid ...

1.如果都是数字类型的直接把这两个字段相加 select a+b as ab from S ; 或者你的意思是 select sum(a+b) from S; 2.如果是不同的字段类型就不能求和了,但是可以使用“||”或者CONCAT()函数 2.1 select a||b from S; 2.2 select concat(a,b) from S;

网站首页 | 网站地图
All rights reserved Powered by www.dkfr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com