网络数据库技术教材相关章节答案
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
有一些实验内容较为简单,或在课堂上讲过的题目并没有提供答案,请自行完成没有提供答案的各章习题。
P94
3.实验内容和步骤
(4 )建立约束
独立实践:为表stud」nfo 的zipcode 列建立default 约束
use student
go
alter table stud_i nfo
add con stra int zipcode_dflt default '210005' for zipcode
(6 )向数据库student 的表中插入数据
独立实践:将赵明同学的入学成绩更新成与学号为03的孔荣同学的入学成绩相同
use student
go
update stud_ info
set mark=(select mark from stud_i nfo where stud_id='03')
where name ='赵明'
(7)删除数据库student 的表数据
2)删除计算机工程系所有学生的成绩记录
Delete from stud_i nfo where substri ng(stud_id,3,2)= '01'
P116
3.实验内容及步骤
(1)SELECT语句的基本使用
1 )略
2 )略
3 )略
4)
Select stud」d as 学号,name as 姓名,address as 地址,telcode as 电话from stud_info where
gender= '女'
6)
Select techer_id, name,tech_title from teacher_ info
where name like ' 王%'
独立实践:
Select teacher_id,course_id from teacher_ info
Where telcode like '%3460%'
7)
Select stud_id,course_id,grade from stud_grade
Where grade betwee n 80 and 90
独立实践
use student
go
Select stud_id ,n ame,address,zipcode from stud_ info where birthday betwee n
'01-01-1987'a nd'12-31-1987'
⑵子查询的使用1)
Select * from teacher_info Where substring ( teach_id , 1, 2 )=
( select deptcode 独
立实践: use student from dept_code where
deptname
=' 计算机工程系 '
go Select
* from teacher_info Where substring ( teacher_id , 1, 4)= ( select jysh_id from staffroom_info Where jysh_name 2) =' 计算机应用 ' ) use student go select teach_id Where substring , name from teacher_info ( teach_id , 1, 2 )=
( select deptcode And course_id = from dept_code where deptname =' 计算机工程系 '
( select course_id from lesson_info Where course_name 提示练习: =' 计算机专业英语 ') Select * from Where substring stud_grade ( stud_id , 3, 2)=( select Deptcode from and courese_id 3) dept_code =( select where course dept_name id from =' 计算机工程 ' ) lesson_info where coure name =' 计算机专业英语 ')
use student go Select stud_id
, name , age , telcode , address
From stud_info Where substring specname =' 计算机应用技术 提示练习: ( stud_id , 3, 4)=( ') use student go Se Select teach_id , name, course_id From teacher_info Where subsring ( teach_id , 1, 2)= from ( select deptcode And substring ( teach_id
dept_name , 3, 2)=
( select substring ( jysh_id , 3, 2) 4) use student go select name, telephone , course_id from teacher_info where ( select select substring where deptname from staff_info substring ( teacher_id , 1, 2) in
deptcode from dept_code where deptname ( speccode , 3, 4) =' 计算机工程系 ' )
where jysh_name =' 计算机工程系 ' ) from specialty_code =' 计算机应用 ' )
and
where