當前位置:首頁 » 編程語言 » 學生成績面試sql
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

學生成績面試sql

發布時間: 2022-07-01 11:19:08

⑴ 求學生表和成績表的sql語句

select student_id,avg(score),max(score),min(score) from t_score GROUP BY student_id

⑵ 查詢每個學生的各科成績sql語句

1、查詢每個學生的各科成績sql語句:

select a.studentid,a.name,a.sex,v1.score as '語文',v2.score as '數學', v3.score as '英語',v4.score

as 『哲學』, (v1.score+v2.score+v3.score+v4.score)/4 as 『平均成績』 from Stuednt a
left join

(select studentid,score from grade where cid=(select cid from course where cname='語文'))as v1

on a.studentid=v1.studentid

left join

(select studentid,score from grade where cid=(select cid from course where cname='數學'))as v2

on a.studentid=v2.studentid

left join

(select studentid,score from grade where cid=(select cid from course where cname='英語'))as v3

on a.studentid=v3.studentid

left join

(select studentid,score from grade where cid=(select cid from course where cname='哲學'))as v4

on a.studentid=v4.studentid

order by a.studentid

2、sql資料庫介紹:

(1)SQL是Structured Query Language(結構化查詢語言)的縮寫。SQL是專為資料庫而建立的操作命令集,是一種功能齊全的資料庫語言。在使用它時,只需要發出"做什麼"的命令,"怎麼做"是不用使用者考慮的。

(2)SQL功能強大、簡單易學、使用方便,已經成為了資料庫操作的基礎,並且現在幾乎所有的資料庫均支持SQL。

(3)SQL資料庫的數據體系結構基本上是三級結構,但使用術語與傳統關系模型術語不同。

(4)在SQL中,關系模式(模式)稱為"基本表"(base table);存儲模式(內模式)稱為"存儲文件"(stored file);子模式(外模式)稱為"視圖"(view);元組稱為"行"(row);屬性稱為"列"(column)。

⑶ sql面試題1 學生成績怎麼解決

最煩的就是面試題,本來程序就是要在不斷的調試和優化下形成的,非讓在紙面上寫,沒一點意義

⑷ sql語句 面試題

這個簡單,看答案,採納吧~
第一題是,用雙top結構就可以查出來
1,select * from 學生表 where 學號 in
(select top 5 學號 from 成績表 where 學號 not in(select top 10 學號 from 成績表 order by 分數) order by 分數)

第二題是比較簡單,用復合函數就行了,having
select 姓名 from 成績表 group by 姓名 having avg(分數)>80
採納吧~

⑸ 資料庫:學生成績分為機試成績,筆試成績,面試成績,使用sql的聚合函數來查詢每個學生的平均成績

sql=select 姓名, 學號 {(機試成績+筆試成績+面試成績)/3} as 平均成績 from 成績表 group by 學號

⑹ SQL語句面試題

SELECT*,
(SELECTCOUNT(*)FROM(SELECTCOUNT(*),b.sidFROMscbLEFTJOINcoursecONb.Cid=c.CidGROUPBYb.sid,c.tid)owWHEREow.sid=a.sid)as'
選課數量',
(SELECTsum(Score)FROMScdWHEREa.sid=d.sid)as'總成績'
FROMstudenta
;

SELECTd.sid,d.snamefromteachera
LEFTJOINcoursebona.tid=b.tid
LEFTJOINscconc.cid=b.cid
leftJOINstudentdONd.sid=c.sid
WHEREa.tname='葉萍';

SELECTsid,sname
FROMstudent
WHEREsidin(selecta.sid
FROMscAleftjoinscbona.sid=b.sid
WHEREa.cid=1andb.cid=2anda.score>b.score)

SELECTsc.Sid,sum(CASEWHENc.Cname='
數學'thensc.Scoreelse0end)數學,SUM(casewhenc.Cname='物理
'THENsc.ScoreELSE0END)物理,AVG(sc.Score)平均分
FROMsc
INNERJOINCourseconsc.Cid=c.Cid
WHEREc.Cnamein('數學','物理')
GROUPBYsc.Sid
ORDERBYAVG(sc.Score)DESC

insertintoSc(Sid,Cid,Score)values(003,3,85);

insertintoSc(Sid,Cid,Score)values(003,3,30);

首先這個不知道是你i寫錯了還是怎麼一個人化學成績有2個所以我在這里按照你這個上做的查詢所以有一個人是選了單個課程

⑺ 今天面試.NET程序員的一道SQL題

SQL Server的話可以這樣寫:
select (select count(*) from test where grade<=a.grade) as xuhao,name,grade
from test a order by grade desc
或者SQL Server 2005的話:
select row_number() over(order by grade desc) as rownum,name,grade
from table1

Oracle的話樓上就是正解

⑻ 這幾個SQL語句面試題該怎麼寫

比如學生表,有學號,姓名,年齡,性別這四個欄位

select a.學號,a.姓名,a.年齡,a.性別,sum(c.成績) as 總成績from 學生表 a,成績表 b,選課表 c where a.學號=b.學號and b.課程號=c.課程號group by a.學號,a.姓名,a.年齡,a.性別order by a.姓名 asc,sum(c.成績) desc

⑼ 查詢學生總成績的sql語句

select 學生.學號 as 姓名, sum(成績.分數) as 總分
from 學生
left join 成績 on 成績.學號=學生.學號
group by 學生.學號

sql語句

  1. 更新:update table1 set field1=value1 where 范圍

  2. 查找:select * from table1 where field1 like '%value1%' (所有包含'value1'這個模式的字元串)

  3. 排序:select * from table1 order by field1,field2 [desc]

  4. 求和:select sum(field1) as sumvalue from table1

  5. 平均:select avg(field1) as avgvalue from table1

  6. 最大:select max(field1) as maxvalue from table1

  7. 最小:select min(field1) as minvalue from table1[separator]

⑽ 學生表 學科表 成績表 獲取學生成績的sql語句

採用以下思路試試

select,sum([成績])from[學生表]a
leftjoin[成績表]bona.[學號]=b.[學號]
groupbya.[姓名]

請採納!