已知三張表結構如下學生學號,姓名,年齡,性別選修

2021-03-03 23:00:46 字數 3132 閱讀 7535

1樓:匿名使用者

1.π學號(δ課程號=k1,課程號=k5(選修))

2.π學號,姓名(δ年齡>23(δ性別='男'(學生))

3.create table 學生(學號 char(6)primary key,姓名 char(6)not null,年齡 int,性別 char(2))

4.select 學號,姓名 from 學生 where 學號 in(select 學號 from 選修 where 課程號 in(select 課程號 from 課程表 where 課程名='c語言')

5.select * from 學生 a,選修 b,課程 c where a.姓名 like 』張%' and a.學號=b.學號 and b.課程號=c.課程號

6. select avg( 成績) from 選修 where 課程號=(select 課程號 from 課程 where 課程名='資料庫系統')

7.update 課程 set 教師名='宋楠' where 課程號='008'

8.delete from 選修 where 課程號 in(select 課程號 from 課程 where 課程名='資料結構')

delete from 課程 where 課程名='資料結構'

學生資料庫包含如下三個表:student(學號,姓名,性別,年齡,所在系)

2樓:匿名使用者

1select student.姓名,sc.成績from student,course,sc where student.

學號=sc.學號 and course.課號=sc.

課號 and student.性別='女'

2select student.姓名,sc.成績from student,course,sc where student.

學號=sc.學號 and course.課號=sc.

課號 and student.年齡=22 and course.課程名='英語'

3select 姓名,year(getdate())-年齡 as 出生年份 from student where  性別='男'

3樓:熊貓娃兒

1、 select 成績 from sc union select 姓名,性別 from student where 性別="女"; 2、select 姓名 from student where 年齡=22 union select 成績 from sc where 成績="英語" 3、select 性別 from student where 性別="男" group by 性別 having year ([年齡]) 錯了請糾正!

已知關係模式:學生(學號.姓名.性別.年齡.系別)選課(學號.課程號.成績)用關係代數實現查詢沒有選修課程號為

4樓:終雯

用sql語言實現下列功能的sql語句**:

1、建立[學生表]**:

學生表(學號 char(6),姓名,性別,年齡,專業)

要求使用:主鍵(學號)、非空(姓名,專業)、檢查(性別)

create table 學生表

(學號 char(6) primary key,

姓名 char(10) not null,

性別 char(2) not null check (性別 in ('男','女')),

年齡 int,

專業 char(20) not null

)2、建立[選課表]**:

選課表(id,學號,課號,分數)

要求使用:外來鍵(選課表.學號,選課表.課程號)、檢查(分數),自動編號(id)

create table 選課表

(id int identity(1,1) not null,

學號 char(6) not null foreign key references 學生表(學號),

課號 char(10) not null foreign key references 課程表(課程號),

分數 int check (分數 between(0,100))

)3、將下列課程資訊新增到課程表的**

課程號 課程名 學分 先行課程號

100002 資料結構 2 100001

修改 課程號為100003的課程名:sql資料庫

刪除 課程號為100002的課程資訊

insert into 課程表 (課程號,課程名,學分,先行課程號)values ('100002','資料結構',2,'100001')

update 課程表 set 課程名 = 'sql資料庫' where 課程號 = '100003'

delete from 課程表 where 課程號 = '100002'

4、寫出建立:選課表檢視(學號,姓名,課程號,課程名,學分,分數)的**

create view uv_選課表_onshow

asselect a.學號,a.姓名,c.課程號,c.課程名,c.學分,b.分數

from 學生表 as a inner join 選課表 as b on a.學號 = b.學號

inner join 課程表 as c on b.課號 = c.課程號

現有關聯式資料庫如下:

學生(學號,姓名,性別,專業,獎學金)課程(課程號,名稱,學分)學習(學號,課程號,分數)用sql實現:

(5)查詢沒有任何一門成績在80分以下的所有學生的資訊,包括學號、姓名和專業

select 學生.學號,學生.姓名,學生.專業

from 學生,學習

where 學生.學號 = 學習.學號

group by 學生.學號,學生.姓名,學生.專業

having min(分數) > 80

(6)對成績得過滿分(100分)的學生,如果沒有獲得獎學金的,將其獎學金設為1000

不知道沒有獲得獎學金的情況下,獎學金是多少,現假設是0

update 學生 set 獎學金 = 1000 where 學號 in (select 學生.學號

from 學生,學習

where 學生.學號 = 學習.學號

group by 學生.學號

having max(分數) = 100) and 獎學金 = 0

求三張原圖id和畫師,求這三張原圖P站畫師名字還有ID

1.這張圖的 貌似已經被移除,畫師應該是這一位 sanmuyyb,p站作者id 117741142.畫師 edogawakid,作者id 1343662,作品id 59359695 3.畫師 七六,作者id 58224256,作品id 58224256 e because of their nar ...

從39這九張卡片中選出三張組成三位數,三張卡片不管怎樣排列,組成的數都能被9整除

只需要3張卡上數字和s 9即可。s可以 18 9 s 18按最大數字分類這些組合 9 8 7 有4 2 1 7種組合 s 9按最大數字分 6 5 4 1 1 1 3種組合總計10種 981 972 963 954 873 864 765621 531 432 9 12,9 13,9 14,9 15,...

求問,這三張是出自於哪幾部動漫,這三張圖片出自哪部動漫

1.這樣算是殭屍嗎?2.花舞少女 3.jojo 之風 請採納 這樣算是殭屍嗎?花舞少女 jojo 這三張 出自哪部動漫?三張都是出自動漫 skip beat 華麗的挑戰 這出自哪部動漫 的超能力女兒 角色 新田義史 b站就有得看 超能力女兒 新田義史 的超能力女兒 這個是超能力女兒,新番,很好看的,...