A. sql語句查詢每個學生的學號、姓名、平均成績、最高成績和最低成績
select 學生表.學號,學生表.姓名,
average(成績表.成績) as 平均成績,
max(成績表.成績) as 最高成績,
min(成績表.成績) as 最低成績
from 學生表 left join 成績表 on 學生表.學號=成績表.學號
order by 學生表.學號
成績表可換成語文、數學、英語等,查詢結果就是各個學生相應課程的平均成績、歷史最高成績、歷史最低成績.
B. 如何用SQL建立一個學生成績管理系統資料庫
首先在SQL中利用企業管理器或向導建立一個資料庫,命名為學生管理系統,
啟動SQL Sever服務,運行企業管理器,單擊要創建資料庫的伺服器左邊的加號圖標,展開樹形目錄,在「資料庫」節點上右擊滑鼠,在彈出的快捷菜單中選則「新建資料庫」命令,然後按照提示一步步建立資料庫,不再詳細敘述。
假設學生管理系統下有三個表,分別為學生表、課程表、修課表,表的結構分別如下:
學生表(student) (
學號(sno) 普通編碼定長字元類型,長度7,主碼,
姓名(sname) 普通編碼定長字元類型,長度8,非空,
性別(ssex) 統一編碼定長字元類型,長度1,
年齡(sage) 微整型,
所在系(sdept) 統一編碼可變長字元類型,長度20
)
課程表(course) (
課程號(cno) 普通編碼定長字元類型,長度6,主碼,
課程名(cname) 統一編碼定長字元類型,長度10,非空,
學分(credit) 小整型,
學期(semester) 小整型
)
修課表(sc)(
學號(sno) 普通編碼定長字元類型,長度7,主碼,外碼
課程號(cno) 普通編碼定長字元類型,長度6,主碼,外碼
成績(grade) 小整型,
修課類別(type)普通編碼定長字元類型,長度4
)
則創建表的語句分別為:
create table Student(
Sno char(7) primary key,
Sname char(8) not null,
Ssex nchar(1),
Sage tinyint,
Sdept nvarchar(20)
)
create table Course(
Cno char(6) primary key,
Cname nchar(10) not null,
Credit smallint,
Semester smallint
)
create table SC(
Sno char(7),
Cno char(6),
Grade smallint,
Type char(4),
primary key(Sno,Cno),
Foreign key(Sno) References Student (Sno),
Foreign key(Cno) References Course (Cno)
)
各表的結構大體如此,如有變化可自行修改。 以上資料庫和表就基本建立好了,然後就可以通過數據導入或SQL語句等向資料庫中添加學生的各項具體數據了。
C. 簡單SQL語句,查詢成績
select * from xs
inner join
(
select km,max(fs) as fs from xs group by km
)w
on xs.km = w.km and xs.fs = w.fs
這樣行不?憑想像寫的,請參考
D. 用sql設計一個成績查詢系統,我的qq是1113600368,謝謝
Based
on
your
subject
用sql設計一個成績查詢系統
,
聯系我們需要提供問題和聯系方式,
如有進一步需求,請我們聯系,
有機會會幫你,
請用BaiHi為我留言,
此回復對於所有需求和和來訪者有效,
ES:\\
E. 怎麼用SQL資料庫編寫學生成績管理系統啊~~~急救!可以追加分!!
---------更新成績status=2 未提交成績 可修改成績 不能插入更新 學生不可查看, status=1成績已提交 不可修改成績 學生可以查看
------插入數據-------------
--用戶信息表
insert into userinfo values('20101000','123',1)
insert into userinfo values('20101004','123',2)
insert into userinfo values('20101152100','123',3)
select*from userinfo
--學生信息表
insert into studinfo values('20101152100','素雅','女','計科1班')
select *from studinfo
--教師信息表
insert into techerinfo values('20101004','李大為','男')
select *from techerinfo
--成績表
insert into studscoreinfo values('5','1003','20101152100','20101003','匯編','99',1)
select *from studscoreinfo
---教師管理成績--------------
--已提交時
update studscoreinfo set studscore='86' where courseid='1002' and studno='20101152103' and status=2
print '已提交不能修改成績'
select*from studscoreinfo
--未提交時
update studscoreinfo set studscore='90' where courseid='1001' and studno='20101152083' and status=1
print '已修改成績'
--提交成績
--改為未提交
update studscoreinfo set status=2 where courseid='1001' and studno='20101152083'
--改為提交
update studscoreinfo set status=1 where courseid='1001' and studno='20101152083'
select *from studscoreinfo
----------------學生----------
---已提交可查看成績時
select studno,teachno,studscore,course,studscore,status
from userinfo U,studscoreinfo S where U.username=S.studno and U.role=3 and S.studno='20101152083' and S.status=1
print '查詢成功!'
---未提交不可查看成績時
select studno,teachno,studscore,course,studscore,status
from userinfo U,studscoreinfo S where U.username=S.studno and U.role=3 and S.studno='20101152083' and S.status=2
print '還不可查詢'
----------系統管理員 可對學生信息,教師信息,成績信息等進行管理----------
select *from userinfo
select *from studinfo
select *from techerinfo
select *from studscoreinfo
--學生信息表---
--增加
insert into userinfo values('20101152101','123',3)
insert into studinfo values('20101152101','陸瓊','女','計科2班')
select *from studinfo
--修改更新
update studinfo set studsex='男' where studno='20101152101'
select *from studinfo
--刪除
delete from studinfo where studno='20101152101'
select *from studinfo
--教師信息表----
--增加
insert into userinfo values('20101005','123',2)
insert into techerinfo values('20101005','燒餅','男')
select *from techerinfo
--修改
update techerinfo set techname='燒包穀' where techname='燒餅'
select *from techerinfo
--刪除
delete from techerinfo where teachno='20101005'
select *from techerinfo
--成績信息表-----
--增加
insert into studscoreinfo values('6','1004','20101152100','20101002','數據結構','70',1)
select *from studscoreinfo
--修改
update studscoreinfo set studscore='100' where studno='20101152100' and courseid='1004'
select *from studscoreinfo
--刪除
delete from studscoreinfo where studno='20101152100'
select *from studscoreinfo
F. 用sql設計一個成績查詢系統,我的qq是1113600368,謝謝
Based on your subject 用sql設計一個成績查詢系統 ,
聯系我們需要提供問題和聯系方式,
如有進一步需求,請我們聯系,
有機會會幫你,
請用BaiHi為我留言,
此回復對於所有需求和和來訪者有效,
ES:\\
G. 怎麼用SQL語句查找學生的成績排名
工具/材料:以Management Studio為例。
1、首先在桌面上,點擊「Management Studio」圖標。