⑴ sql:查詢所有學生的學號、姓名、入學成績、選課門數和平均分。結果要求顯示如下
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下測試通過。
⑵ 創建觸發器trigger5,實現當向學生成績表(xscj)中插入一條選課紀錄時,查看該學生的
create trigger trigger5
AFTER INSERT ON xscj
FOR EACH ROW
BEGIN
selelct * from xscj
END
⑶ 已知資料庫中有表:學生(學號,姓名,性別,年齡,班級)選課(學號,課程號,成績)課程(課程號,課程
select a.id,a.name,a.class from student a where a.age>20;
select b.id,a.name ,a.class,b.scorefrom xuanke b inner join student a on b.kechengid='c1' and b.score>60;
select a.name,avg(b.score) from xuanke b inner join student a on b.score>70 order by(avg(b.score));
這些語句都不難,好好看版權看
⑷ 7、 以學生表和成績表為數據源,建立名為「未選課學生查詢」的嵌套查詢,查詢出學生的學號和姓名。所謂未
以下的sql語句可以參考一下:
select 學號,姓名
from 學生表
where 學號 not in ( select distinct 學號 from 成績表 )
⑸ 跪求大神幫幫忙!!!有一個【學生選修課】資料庫,資料庫中包括三個表,學生表,課程表,成績表
//自己把中文替換成英文欄位名 我用的sql server資料庫
select 學號、姓名、性別、年齡、所在系 from 學生 order by 年齡 desc, 學號 asc
select 學號,姓名 from 學生 where 姓名 in( select 姓名 from 學生 group by 姓名 having count(*)>1 )
update 成績 set 成績=0 where CNO=1
如果/不是除法的話 只是字元串 (除法暫時有問題)下班了 明天再來寫
select C.課程號,D.課程名,D.成績 from COURSE C,(
select CONVERT(VARCHAR(50),A.排名)+'/'+CONVERT(VARCHAR(50),B.ZS) as '排名/人數',a.學號,a.課程名,a.成績 FROM (
select ROW_NUMBER() over(partition BY 課程名 order by 成績 desc) as 排名 ,* from GRADE where 學號='1') A,
(SELECT COUNT(*) as zs,課程名
FROM GRADE group by 課程名 ) B where a.課程名=b.課程名) D WHERE C.課程名=D.課程名
⑹ SQL語句的一道題 三個基本表:學生表(Student)、課程表(Course)、學生選課表(SC)
老師留的作業嗎?為你好,自己做吧。
⑺ 從學生表和選課成績統計並顯示每個學生學號,姓名,各科成績之和用sol編碼怎麼
從學生表和選課成績統計並顯示每個學生學號,姓名,各科成績之和用sol編碼殖後期,勤開機,促進水產養殖對象生長
⑻ 從學生選課資料庫中查詢選修「資料庫原理」課並且成績在90分以上的學生名單,請寫出SQL語句.
select sname from student
where sno in(
select a.sno from studentcourse a join course b
on a.cno=b.cno
where b.cname='資料庫原理' and a.score>90)
select a.sclass as 班級,count(*) as 不及格人專數屬 from
student a join studentcourse b
on a.sno=b.sno
where b.score<60
group by a.sclass
⑼ visual foxpro 中更新將grade表中選修課程編號為「08001」課程的學生的成績加5
命令一:用替換命令
USE grade
REPLACE ALL 成績 WITH 成績+5 FOR 選修課程編號="08001"
命令二:用數據表記錄專修改命屬令
UPDATE grade SET 成績=成績+5 WHERE 選修課程編號="08001"
⑽ 資料庫中現有學生表,選課表,成績表,怎麼刪除大於18歲學生的所有選課信息
假設這3個表的結構如下:
學生表(學號,姓名,年齡,出生日期)
選課表(學號,課程號,課程名稱)
成績表(學號,課程號,成績)
以上述表結構為前提,T-SQL語句如下:
delete 成績表 where 學號 in (select 學號 from 學生表 where 年齡>18)
delete 選課表 where 學號 in (select 學號 from 學生表 where 年齡>18)
如果學生表中沒有『年齡』欄位,只有『出生日期』欄位的話,T-SQL語句如下:
delete 成績表 where 學號 in (select 學號 from 學生表 where datediff(yy,出生日期,getdate())>18)
delete 選課表 where 學號 in (select 學號 from 學生表 where datediff(yy,出生日期,getdate())>18)