當前位置:首頁 » 操作系統 » 大學資料庫試題

大學資料庫試題

發布時間: 2025-08-21 23:56:28

❶ SQL試題求解

1
IF OBJECT_ID('學生表')IS NOT NULL
DROP TABLE 學生表
GO
create table 學生表 --建立學生表.
(
學號 int not null , --學號,姓名,年齡,性別,家庭住址,聯系電話
姓名 varchar(10) not null, --姓名
性別 varchar(2)
年齡 int,
聯系電話 varchar(10),
家庭住址 varchar(50),
聯系電話 varchar(20),
check (性別 ='男' OR 性別='女'),
)

1.1
delete 學生表
insert 學生表 (學號,姓名,年齡,性別,聯系電話,學歷)
values(1,"A",22,"男","123456","小學")
insert 學生表 (學號,姓名,年齡,性別,聯系電話,學歷)
values(2,"B",21,"男","119","中學")
insert 學生表 (學號,姓名,年齡,性別,聯系電話,學歷)
values(3,"C",23,"男","110","高中")
insert 學生表 (學號,姓名,年齡,性別,聯系電話,學歷)
values(4,"D",18,"女","114","大學")

1.2
update 學生表
set 學歷='大專'
where 聯系電話 like '11%'
go

1.3
delet 學生表
where 性別='女',姓名 like 'B%'
go

1.4
select 姓名,學號
from 學生表
where 學歷='大專',年齡<22
go

1.5
select 姓名,性別
from 學生表
order by 年齡 desc
go

2.1
use stu
IF OBJECT_ID('Student')IS NOT NULL
DROP TABLE Student
GO
create table Student --建立學生表.
(
學號 int not null ,
姓名 varchar(10) not null, --姓名
性別 varchar(2)
年齡 int,
所在系 varchar(10),
check (性別 ='男' OR 性別='女'),
)

2.2
use stu
select 學生表.學號
from Student As 學生表,SG As 成績表
where 學生表.學號=成績表.學號,成績表.成績<60
go

2.3
use stu
select 姓名,性別,年齡
from Student
where 所在系='計算機系',性別='男',姓名 like '張%'
go

2.4
use stu
insert Student (學號,姓名,年齡,性別,所在系)
values(05020,"高平",19,"女","積極管理系")
go

4.1
刪除student表中學號為2004009的學生的信息

4.2
在stu資料庫的student表中創建列名為姓名,家庭住址的視圖student_view

4.3
查詢stu資料庫的student表中前9條信息

4.4
在stu資料庫的student表中創建查詢學號,姓名,家庭住址的存儲過程student_pro

4.5
在stu資料庫的student表中創建帶輸入參數的存儲過程

4.6
查詢Sg表中課程號為06的平均成績

熱點內容
爐石傳說威脅腳本投降 發布:2025-08-22 01:54:10 瀏覽:329
大大哇腳本 發布:2025-08-22 01:49:32 瀏覽:93
python2pip 發布:2025-08-22 01:48:56 瀏覽:387
php和null 發布:2025-08-22 01:48:49 瀏覽:963
安卓手機怎麼強制解鎖 發布:2025-08-22 01:48:48 瀏覽:80
安卓422怎麼樣 發布:2025-08-22 01:48:48 瀏覽:624
資料庫nf 發布:2025-08-22 01:47:01 瀏覽:857
怎麼給伺服器裝插件 發布:2025-08-22 01:19:59 瀏覽:857
自己怎麼搭建網站伺服器 發布:2025-08-22 00:36:54 瀏覽:141
按鍵精靈只能做手游腳本嗎 發布:2025-08-22 00:31:22 瀏覽:152