Ⅰ sql語句查詢
1、select distinct s.學號,姓名 from s,c,sc where s.學號=sc.學號 and c.課程號=sc.課程號 and 成績>=85
2、select s.學號,姓名,平均成績=avg(成績) from s,sc where s.學號 in (select 學號 from sc group by 學號 having count(學號)>5
3、select 書名 from 圖書 where 出版單位='清華大學出版社' or '電子工業出版社' and 單價>20
4、select 出版單位,最高單價=max(單價),平均價=avg(單價),冊數=count(出版單位) from t where 出版單位 in (select 出版單位 from t group by 出版單位) group by 出版單位
5、select 借出數量=count(*) from 借閱
6、select 班級,總人數=count(*) from 學生表 group by 班級
兄弟,我終於給你寫完了!你是不是要加點分我!這么冷的天,我手凍凍紅了!
至於是不是有錯誤,你試一試哈!
錯誤是有的,有時間我給你改改哈!第二個有問題
Ⅱ sql語句列出成績在80分到100分之間的學生名單
select * from 學生表 where 學生表主鍵id in (select 學生表學生id from 成績表 where 成績欄位 between 80 and 100)
或
select * from 學生表 where 學生表主鍵id in (select 學生表學生id from 成績表 where 成績欄位>=80 and 成績欄位<=100)
Ⅲ sql把student表中大於85分的顯示為優,75-84為良,60-74及格,小於60顯示為不及格,空的顯示為缺考
select name,chengji,(case when chengji >85 then '優'
when chengji between 75 and 84 then '良'
when chengji between 60 and 74 then '及格'
when chengji <60 then '不及格'
when chengji is null then '缺考' end) 分數等級評價
from student;
運行結果:
name 分數 分數等級評價
小紅 55 不及格
王一 89 優
Ⅳ 為學員成績表中增加一行數據 學員張偉的資料庫考試成績為80分 sql語句怎麼寫
insertinto成績表(學員,科目,成績)values('張偉','資料庫',80)
Ⅳ sql語句查詢的一個問題,查詢成績有在85分以上的課程號
都對了,但是如果單純這個題的話,第二個答案中的嵌套完全沒有必要的,只會降低執行效率
Ⅵ 用SQL語句完成下列問題。
1、第一題,是查詢總和,總和在SQL中使用sum,如:select sum(成績) from 表名
2、第二題,查詢平均值,SQl:select 學號,Avg(sum(成績)) from 表名 group by 學號
3、第三題,查詢每課程學生人數,SQL : select 課程名稱,count(學號) from 表名 group by 課程名稱
4、第四題,查詢最高分,也就是最大值,select max(成績),學號 from 表名 group by 學號
5、第五題,查詢每科的最高分,SQL:select max(成績),課程 from 表名 group by 課程 最低分 select min(成績),課程 from 表名 group by 課程 平均分 select Avg(sum(成績)),課程 from 表名 group by 課程
6、第六題 顯示綜合大於250分的信息 SQL: select 學生ID,sum(成績) 總分 from 表名 where sum(成績)>250 group by 學生ID
7、第七題 顯示平均分 SQL:select 學生ID,Avg(sum(成績)),課名 from 表名 where sum(成績)>250 group by 學生ID,課名 order by Avg(sum(成績)) asc
8、第八題 查詢人數 SQL:select 課程ID,sum(學生ID) from 表名 where sum(學生ID)>=30 group by 課程ID
9、第九題 查詢最高分 SQL:select max(成績),課程,學生名字 from 表名 where max(成績)>=90 group by 課程,學生名字
10、第十題 成績>=60,平均分>85 SQL:select 學生 from 表名 where avg(sum(成績))>85 and min(成績)>=60 order by avg(sum(成績)) desc
好辛苦,望採納
Ⅶ SQL顯示平均成績高於85分的學生的學號和姓名
SELECT student.S'學號',Sname'姓名',AVG(score)'平均成績'
FROM student
INNER JOIN sc
ON student.S=sc.S
GROUP BY student.S
HAVING AVG(score)>=85
Ⅷ sql分組統計成績在85分以上的學生選課情況, 只顯示選課2門及以上的學生信息;
SQL語句如下:
select student.sno 學號,sname 姓名,sgrade 入學成績,count(cno)選課門數,avg(grade)平均分
from student,score
where student.sno=score.sno
group by student.sno,sname,sgrade;
其中sno、sname、sgrade、cno、grade分別為:學號、姓名、入學成績、課程號、成績。以上SQL語句在Microsoft SQL Server 2005下測試通過。
Ⅸ 查詢選修了C語言的成績在85分以上的學生學號(取消重復值)用Sql語句寫出來
selectstudent,course,resultfromtableAwherecourse='C語言'andresult>85groupbystudent
Ⅹ 求SQL語言 VF
1.Select
姓名,選修的
課程
名,成績
where
學號
=
'S1'
Order
By
成績
DESC
2.Select
*
From
學生表
where
課程名
=
'計算機軟體基礎'
and
成績
<=
85
3.Select
學號,姓名,課程名,成績
Into
sclist
From
學生表
Order
By
課程名,成績
4.Select
CourseName
課程名,avg(Score)
Into
NEWTABLE
From
表
where
課程名
=
'***'
Order
by
課程名