当前位置:首页 > sql数据库期末考试题及答案
。
IF EXISTS(SELECT ① FROM Sysobjects
WHERE name=’my_proc’ and type=’ ② ’) DROP PROC my_proc GO
CREATE PROC my_proc
@a int, @b char(8),@c char(50) ③
INSERT INTO clients(client_id,client_name,address) VALUES(@a,@b,@c) GO
问题:(1)填写该程序段中空白处的内容:① ② ③ (2)任写一条调用该存储过程的语句: 。 参考答案
一、 单项选择题(每题2分,共15题)
1. C 2.B 3.D 4.C 5.B 6.B 7.C 8.C 9.A 10.D 11.D 12.D 13.C 14.D 15.D 二、 填空题(每空2分,共15空)
1.数据共享 可控冗余 2.GO 3. 64KB 4.非聚集索引 5.AVG函数 6.游标结果集 游标位置 7.一致性 隔离性 8.CREATE DATABASE ALTER DATABASE 9.约束 默认值 三、 简答(10分)
1.DECLARE cname char(16) SET cname=’数据库系统概述’
-可编辑修改-
。
或者是
DECLARE cname char(16)
SELECT cname=’数据库系统概述’ 2.CHAR(13)+CHAR(10) 四、 程序阅读题(5分) 1. name P as
2. EXEC my_proc 7,‘李好’,‘考试书店’或者 EXEC my_proc @a=7,@b=‘李好’试书店’
五、 编程题(25分,共4题) 1、 (4分)
update course (1分) set 学分=4 (2分) where课程号=2 (1分)
2、select * from student where 年龄>18 order by 学号 desc (5分) 1分 1分 1分 2分 3、(6分) 方法1:
select distinct student.学号,姓名,性别 (1分) from student, course, sc (1分)
where (student.学号=sc.学号) and (course.课程号=sc.课程号) and (course.学分=4) and (sc.成绩>80) (1+1+1+1分) 方法2:
-可编辑修改-
@c=‘考,。
select distinct student.学号,姓名,性别 (1分)
from student Inner Join (sc Inner Join course On course.课程号=sc.课程号)
On student.学号=sc.学号 (2分+2分)
where (course.学分=4) and (sc.成绩>80) (1分+1分) 4、(10分)
If exists(Select name From sysobjects
Where name=’my_trig’and type=’tr’) (整个If语句 1分) Drop trigger my_trig (0.5分) Go (0.5分)
Create trigger my_trig (1分) On student (0.5分) For Delete (1分) As (0.5分)
Delete From sc (2分)
Where 学号 in (Select 学号 From Deleted) (1分+2分) Go
-可编辑修改-
。
-可编辑修改-
共分享92篇相关文档