网络数据库技术教材相关章节答案
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
网络数据库技术教材相关
章节答案
Newly compiled on November 23, 2020
有一些实验内容较为简单,或在课堂上讲过的题目并没有提供答案,请自行完成没有提供答案的各章习题。
P94
3.实验内容和步骤
(4)建立约束
独立实践:为表stud_info的zipcode列建立default约束
use student
go
alter table stud_info
add constraint zipcode_dflt default'210005'for zipcode
(6)向数据库student的表中插入数据
use student
go
update stud_info
where name='赵明'
(7)删除数据库student的表数据
2)删除计算机工程系所有学生的成绩记录
Delete from stud_info where substring(stud_id,3,2)= '01'
P116
3.实验内容及步骤
(1)SELECT语句的基本使用
1)略
2)略
3)略
4)
Select stud_id 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 between 80 and 90
独立实践
use student
go
Select stud_id,name,address,zipcode from stud_info where birthday between '01-01-1987'and'12-31-1987'
(2)子查询的使用
1)
Select*from teacher_info
Where substring(teach_id,1,2 )=
(select deptcode from dept_code where deptname='计算机工程系')
独立实践:
use student
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,name from teacher_info
Where substring(teach_id,1,2 )=
(select deptcode from dept_code where deptname='计算机工程系')
And course_id=
(select course_id from lesson_info
Where course_name='计算机专业英语')
提示练习:
Select*from stud_grade
Where substring(stud_id,3,2)=(select
Deptcode from dept_code where dept_name='计算机工程')
and courese_id =(select course_id from lesson_info where coure_name='计算机专业英语')
3)
use student
go
Select stud_id,name,age,telcode,address
From stud_info
Where substring(stud_id,3,4)=(select substring(speccode,3,4)from
specialty_code where specname='计算机应用技术')
提示练习:
use student
go
Se
Select teach_id,name,course_id
From teacher_info
Where subsring(teach_id,1,2)=
(select deptcode from dept_name where deptname='计算机工程系')
And substring(teach_id,3,2)=
(select substring(jysh_id,3,2)from staff_info where jysh_name='计算机应用') 4)
use student
go
select name,telephone,course_id
from teacher_info
where substring(teacher_id,1,2)in
(select deptcode from dept_code where deptname='计算机工程系')and
course_id=(select course_id from lesson_info where course_name ='多媒体技术')独立实践:
use student
go
select stud_id,name,grade from stud_grade
where substring(stud_id,3,2)=(select deptcode from dept_code where
deptname='计算机工程系')
and course_id=(select course_id from lesson_info where course_name ='多媒体技术')
(3)连接查询的使用
1)
use student
go
select*from stud_info inner join stud_grade
on=
独立实践:
use student
go
select*from teach_schedule inner join lesson_info
on=
2)
use student
go
select,,
from teacher_info left outer join lesson_info
on=
独立实践:
use student
go
select,,,course_date,course_week,room_id,deptcode
from teacher_info right outer join teach_schedule
on=
(4)数据汇总
1)
select avg(salary)as计算机工程系教师平均工资
from teacher_info
where left(teacher_id,2)=(select deptcode from dept_code where deptname='计算机工程系')
独立实践: