五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

阿花兒】重慶專升本-數(shù)據(jù)庫專項訓(xùn)練【答案】

2021-03-10 15:29 作者:張悅_阿花兒  | 我要投稿

數(shù)據(jù)庫專項訓(xùn)練

某數(shù)據(jù)庫中存在以下幾個關(guān)系

Student表?? Sno,Sname,sex,Birthday,Tall,Class,Major ??其中Birthday為Date型數(shù)據(jù),Tall為Int型數(shù)據(jù)

Teacher表 ??Tno,Tname,sex,Age,Sal,Dept???? 其中Age和Sal為Int型數(shù)據(jù)

Score表???? Num,Sno,Subject,Score?????? 其中Score為Int型數(shù)據(jù)

1.在Student表中插入一條學(xué)生信息,(S0001,阿花兒,男,1994年10月28日,2班,計算機)

【參考答案】

?????? insert into Student

?????? values("S0001","阿花兒","男",#1994/10/28#,"2班","計算機")

2.在Teacher表中插入一條老師信息,(T0001,王雨霜,女,24,英語),工資未定。

【參考答案】

?????? insert into Teacher(Tno,Tname,sex,Age,Dept)

?????? values("T0001","王雨霜","女",24, "英語")

3.在Student表中刪除一條姓名為“阿花兒”的學(xué)生的信息。

【參考答案】

delete from Student

where Sname="阿花兒"

4.在Teacher表中刪除年齡大于25歲的男老師的信息。

【參考答案】

?????? delete from Teacher

?????? where sex="男" and Age>25

5.在Teacher表中,將王雨霜老師的年齡增加5歲,將王雨霜老師的工資增加5000元。

【參考答案】

?????? update Teacher

?????? set Age=Age+5,sal=sal+5000

?????? where Tname="王雨霜"

6.在Score表中刪除計算機或者英語小于60的學(xué)生的信息。

【參考答案】

?????? delete from Score

?????? where (Subject="計算機" and Score<60) or (Subject="英語" and Score<60)

?????? 或者

?????? delete form Score

?????? where (Subject="計算機" or Subject="英語") and (Score<60)

7.刪除Teacher關(guān)系。

【參考答案】

?????? Drop table Teacher

8.新增一個Teacher關(guān)系,關(guān)系字段為Tno,Tname,Age,Sal,Dept,其中Age和Sal為Int型數(shù)據(jù)。

【參考答案】

?????? Create Table Teacher

?????? (Tno char(32),

Tname char(32),

Age Int,

Sal Int,

Dept Char(32))

//char(32)可以寫成Text(32) String(32) Vchar(32)

9.在Student表中查詢出90后的女學(xué)生的信息。

【參考答案】

?????? select *

?????? from Student

?????? where Year(Birthday) between 1990 and 1999 // where Year(Birthday)>=1990 and Year(Birthday)<=1999

或者

?????? select *

?????? from student

?????? where Birthday between #1990/1/1# and #1999/12/31#

10.從Student表中查詢出所有姓“王”的學(xué)生的信息。

【參考答案】

select *

from Student

where Sname like "趙*"

11.統(tǒng)計出Score表中數(shù)學(xué)成績大于60分的學(xué)生的人數(shù)。

【參考答案】

select count(*) as 人數(shù)

from Score

where Dept="數(shù)學(xué)" and Score>60

12.統(tǒng)計出Score表中數(shù)學(xué)成績大于60分的學(xué)生的學(xué)號、姓名、班級、數(shù)學(xué)成績等信息。

【參考答案】

?????? select Student.Sno,Student.Sname,Student.Class,Score.Score

?????? from Student,Score

?????? where Score.Score>60 and Score.subject="數(shù)學(xué)"

13.統(tǒng)計出Score表中數(shù)學(xué)的最高成績,最低成績。

【參考答案】

select max(Score) as 最高成績,min(Score) as 最低成績

from Score

where Subject="數(shù)學(xué)"

14.統(tǒng)計出全班數(shù)學(xué)成績大于60分的學(xué)生的學(xué)號、姓名、班級、科目、數(shù)學(xué)成績等信息。

【參考答案】

?????? select Student.Sno,Student.Sname,Student.Class,Score.Subject,Score.Score

?????? from Student,Score

?????? where Student.Sno=Score.Sno and (Score.Subject="數(shù)學(xué)" and Score.Score>60)

15.統(tǒng)計出全班每個男生的姓名及其年齡大小。(根據(jù)出生日期進行計算)

【參考答案】

?????? select Sname, Year(Date()) - Year(Birthday) as Age

?????? From Student

?????? where sex = "男"

16.字Student表中查詢出所有女生的信息,并按照出生日期進行降序排序。

【參考答案】

select *

from Student

where sex= "女"

order by Birthday desc

17.在Student表中統(tǒng)計出所有男生的平均身高,最高身高和人數(shù)。

【參考答案】

?????? select avg(Tall) as 平均身高,max(Tall) as 最高身高,count(*) as 男生人數(shù)

?????? from Student

?????? where sex="男"

18.統(tǒng)計出學(xué)生的平均年齡。

【參考答案】

?????? select avg(year(date())-year(Birthday)) as 平均年齡

?????? from Student

19.分別統(tǒng)計出男生和女生的平均身高、最高身高。

【參考答案】

?????? select sex,avg(Tall) as 平均身高,max(Tall) as 最高身高

?????? from Student

?????? group by sex?

20.分別統(tǒng)計出男生和女生的人數(shù)。

【參考答案】

select sex,count(*) as 人數(shù)

from Student

group by sex


阿花兒】重慶專升本-數(shù)據(jù)庫專項訓(xùn)練【答案】的評論 (共 條)

分享到微博請遵守國家法律
瑞金市| 台中市| 承德市| 贵定县| 新宾| 黎城县| 太康县| 中方县| 韩城市| 客服| 北辰区| 新民市| 濮阳市| 平乐县| 龙川县| 佛山市| 来凤县| 枣阳市| 汝州市| 聊城市| 义乌市| 元朗区| 定日县| 大邑县| 南岸区| 阳江市| 西昌市| 宜州市| 镇远县| 和平县| 遂溪县| 福清市| 剑河县| 德江县| 岑巩县| 安岳县| 赤壁市| 呼伦贝尔市| 蒲江县| 宜章县| 平定县|