當前位置:首頁 » 考試成績 » c學生表課程表成績表

c學生表課程表成績表

發布時間: 2020-12-07 03:03:21

① SQL命令 「學生」資料庫中有 「學生表」、「課程表」和 「成績表」。 「學生表」中包含學號、姓名

1、首先在電腦上打開資料庫軟體。然後附加有學生表和成績表的資料庫。

② 學生表、成績表、課程表作為數據基礎表,寫出如下SQL語句,謝謝

查詢所有學生的成績信息(無成績的學生也需顯示)
SELECT ST.SNO, ST.SNAME, AVG(GRD.GRADE) AS AVG_GRADE FROM STUDENT ST LEFT JOIN GRADE GRD
ON (ST.SNO = GRD.SNO) GROUP BY ST.SNO, ST.NAME

查詢8002課程的平均分、最高分以及課程名稱,且平均分保留2位小數
SELECT C.CNAME, ROUND(AVG(GRD.GRADE),2) AS AVERAGE_GRADE, ROUND(MAX(GRD.GRADE),2) AS MAX_GRADE FROM COURSE C INNER JOIN GRADE GRD ON (C.CNO = GRD.CNO)
WHERE C.CNO = 8002

③ 資料庫多表查詢,學生表,課程表,成績表

直接將三表關聯查詢就可以了
select
b.姓名,c.課程,a.成績
from
成績表
a,學生表
b,課程表
c
where
a.學生學號
=
b.學號
and
a.課程編號
=
c.編號
and
a.成績
<
60

④ 數據表 學生表,老師表,課程表,成績表 S(S#,Sname)T(T#,Tname,age)C(C#,Cname,T#) SC(S#,c#,sore)

1. select 學號,avg(成績復) from 表名 where avg(成績)>60 group by 學號
2、制update 表名 set 名字=』王文『 where 課程=『地理』
3和4 我不寫了 我不清楚欄位是什麼 。這個都應該是操作多張表 你根據他們的關聯性去寫吧 關聯性 有找主外鍵用主外鍵作為條件,沒有就找關聯性 相同的欄位,進行修改、刪除操作

⑤ 學生表(學號,姓名)、課程表(課程編號,課程名)、成績表(自動編號、學號,課程編號,成績) 查詢各個學生學

select A.姓名,
sum(case B.課程名 when '語文' then C.成績 else 0 end) as 語文,
sum(case B.課程名 when '數學' then C.成績 else 0 end) as 數學,
sum(case B.課程名 when '英語' then C.成績 else 0 end) as 英語,
sum(case B.課程名 when '歷史' then C.成績 else 0 end) as 歷史,
from 學生表 A left join 成績表 C on 學生表.學號=成績表.學號
left join 課程表 B on 成績表.課程編號=課程表.課程編號
group by A.姓名
剛剛不是在那邊回答你了么~~~

⑥ 給定資料庫中,包括「學生表」,「課程表」,「選課表」等三個數據表,表結構如下: 學生表:學號(C,6),姓

用LINQ(語言集成查詢)完成你說的這些任務很方便,具體的細節問題還得你自己做。下面舉出兩個例子供你參考,這兩個例子用數組代替資料庫,對資料庫也可用同樣的方法。
例1,用bool值作關鍵字區分兩組的結果,注意group子句中的表達式產生的結果。
public class Student
{
public string Name { get; set; }
public int ID { get; set; }
public List<int> Scores;
}
public static List<Student> GetStudents()
{
//實例化數據源,注意各成員內部成績序列的初始化
List<Student> students = new List<Student>
{
new Student {Name="張勇", ID=1, Scores= new List<int> {97, 72, 81, 60}},
new Student {Name="王磊", ID=2 Scores= new List<int> {75, 84, 91, 39}},
new Student {Name="孫敏", ID=3, Scores= new List<int> {88, 94, 65, 85}},
new Student {Name="劉曉", ID=4, Scores= new List<int> {97, 89, 85, 82}},
new Student {Name="揚帆", ID=5, Scores= new List<int> {35, 72, 91, 70}}
};
return students;
}
static void Main()
{
List<Student> students = GetStudents();
//用true或false分組,查詢變數是IEnumerable<IGrouping<bool, Student>>類型
var booleanGroupQuery = from student in students
group student by student.Scores.Average() >= 80;
foreach (var studentGroup in booleanGroupQuery)
{
Console.WriteLine(studentGroup.Key == true ? "平均分高於80" : "平均分低於80");
foreach (var student in studentGroup)
Console.WriteLine("{0,4} {1} {2}", student.ID, student.Name, student.Scores.Average());
}
}
輸出:
平均分低於80
1 張勇 77.5
2 王磊 72.25
5 揚帆 67
平均分高於80
3 孫敏 83
4 劉曉 88.25
例2,查詢人名先排序再分組,可以用姓作為分組關鍵字。
string[] Name = {"張明","劉新","王宏","劉洋","張媛","張寶","王金貴","劉東","王凱","劉芳"};
var sortedGroups = from name in Name
orderby name
group name by name[0] into newGroup
select newGroup;
foreach (var nameGroup in sortedGroups)
{
Console.WriteLine(nameGroup.Key);
foreach (var name in nameGroup)
Console.WriteLine(" "+name);
}
輸出:

劉東 劉芳 劉新 劉洋

王宏 王金貴 王凱

張寶 張明 張媛
輸出結果按姓分類,組內排序。
《C#編程指南》(清華大學出版社2011年1月出版,可網購)第5章和第17章專門討論LINQ查詢更新資料庫。

⑦ SQL查詢,學生表,課程表,成績表的一個查詢要求如下怎麼寫呢

selects.sid,s.sname,sc.scorefromstudent,course,scwherestudent.sid=sc.sidandcourse.cid=sc.cidandcourse.cname='影視設計';

注意一下,你自己寫的sid和sname中間沒有逗號,到時候一定執行報錯

⑧ 資料庫多表查詢,學生表,課程表,成績表

直接將三表關聯查詢就可以了
select b.姓名,c.課程,a.成績
from 成績表 a,學生表 b,課程表 c
where a.學生學號 = b.學號 and a.課程編號 = c.編號 and a.成績 < 60

⑨ 有四張表 student(s#,sname,sage,sex)學生表,Course(c#,cname,t#)課程表,SC(s#,c#,score)成績表,

全部通過測試-----
第一題
select a.sno,count(a.sno) as 選課數,Sum(c.score) as 總成績
from student as a,course as b,SC as c
where a.sno=c.sno and b.cno=c.cno
group by a.sno
第二題
select sno,sname from student
where sno in(
select distinct(d.sno)
from student as d,sc as e
where
d.sno=e.sno and e.sno<>'001' and
e.cno in
(
select b.cno
from student as a,course as b,SC as c
where a.sno=c.sno and b.cno=c.cno and a.sno='001'
))
第三題
update sc
set score=(select e.cavgScore from(
select cno as classno,avg(score) as cavgScore
from sc
where cno in(
select cno
from course as a,teacher as b
where tname='葉平')
group by cno) as e where classno=cno)
第四題
delete from sc
where sc.cno in
(
select a.cno
from course as a,teacher as b
where a.tno=b.tno and b.tname='葉平'
)

⑩ 跪求大神幫幫忙!!!有一個【學生選修課】資料庫,資料庫中包括三個表,學生表,課程表,成績表

//自己把中文替換成英文欄位名 我用的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.課程名

熱點內容
武漢大學學生會輔導員寄語 發布:2021-03-16 21:44:16 瀏覽:612
七年級學生作文輔導學案 發布:2021-03-16 21:42:09 瀏覽:1
不屑弟高考成績 發布:2021-03-16 21:40:59 瀏覽:754
大學畢業證會有成績單 發布:2021-03-16 21:40:07 瀏覽:756
2017信陽學院輔導員招聘名單 發布:2021-03-16 21:40:02 瀏覽:800
查詢重慶2018中考成績查詢 發布:2021-03-16 21:39:58 瀏覽:21
結業考試成績怎麼查詢 發布:2021-03-16 21:28:40 瀏覽:679
14中醫醫師資格筆試考試成績查分 發布:2021-03-16 21:28:39 瀏覽:655
名著賞析課程標准 發布:2021-03-16 21:27:57 瀏覽:881
北京大學商業領袖高端培訓課程 發布:2021-03-16 21:27:41 瀏覽:919