㈠ sql 查詢某門課程及格的總人數以及不及格的總人數以及沒成績的人數
1、創建測試表,
create table test_score(class_id varchar2(20), student_id varchar2(20), score number);
㈡ sql語句中查詢報考各專業的考生人數
select 專業,count(專業) from table group by 專業
㈢ SQL 語句 查詢每個考生的身份證號和參加考試的次數
可以使用函數COUNT統計考試次數(即身份證號的出現次數),供參考的SQL語句:
SELECT 身份證號,COUNT(身份證號) AS 考試次數 FROM grade GROUP BY 身份證號
㈣ 資料庫中查詢所有參與了考試的學生的考生姓名,年齡,平均成績,考試次數。
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 查詢某門課程及格的總人數以及不及格的總人數以及沒成績的人數
你的要求有點特別,要求
學號!
如果只是
統計每門課程的不及格人數下面的sql就可以啦:
select
cnum,count(cnum)
as
不及格人數
from
sc
where
score
<
60
group
by
cnum
注意:是對課程號分組喲,樓上的是錯的。
如果你要輸出學號:
select
sc.snum
as
學號,
a.cnum
as
課程號,
a.不及格人數
from
sc,
(select
cnum,count(cnum)
as
不及格人數
from
sc
where
score
<
60
group
by
cnum)
as
a
where
sc.score<60
and
sc.cnum=a.cnum
以上我相信是沒有問題的,你測試一下!
如果ok,給分喲
呵呵
㈥ sql 語句 這個代碼怎麼修改 要求是查詢數學考試成績超過75分的男學生的總人數(要求關聯g_Sexinfo)
selectcount(*)
fromg_stuinfoa,g_courseinfob,exam_scorec,g_sexinfod
wherea.stuid=c.stuid
andb.courseid=c.courseid
anda.sexcode=d.sexcode
andd.sexname='男'
andc.score>75
andb.course='數學'
這個你不要使用左連接,查人數時會出錯的
㈦ 用SQL語句查詢沒有通過考試的人數(筆試或機試小於60分)
select count(*) from 考試表 where writtenExam<60 or labExam<60
㈧ SQL 語句查詢所有參加考試的學生,從Stu表中和Sco表中
select * from score(成績表) where stuno(考號) in (select stuno from student)
思路是這樣的,學生表中有的考號在成績表中出現,就叫做參加考試了,更詳細的就是說,機試和筆試成績都不為null
㈨ sql 語句編寫 查詢參加全部科目考試的學生及其成績 201601 張三 語文 82
select * from 表名
seelct name,subjict from 表名 where 數學 is null and 語文 is null
太復雜