SQL 实验课后习题分析及参考答案
2013级计科三班 李松 QQ 1070445933 TEL 15091266287
制作
写在前面
由于所使用的教材并没有课后习题答案,本作者也尝试联系出版社寻求答案未果,应老师的要求写了课后习题的分析以及参考答案,在觉得有必要知识扩展的地方都有相应的知识扩展,所有的代码语句均由作者亲自运行无误。因电脑问题本文档是基于SQL2008 如有与SQL2005不对应的地方或者在使用过程中发现错误请及时联系作者
目录
实验一 数据库 ............................................................................................................................. 6
【思考题】 ............................................................................................................................... 6
1......................................................................................................................................... 6 2. ...................................................................................................................................... 6 3......................................................................................................................................... 6 4......................................................................................................................................... 6 5. ...................................................................................................................................... 7 6......................................................................................................................................... 8 7......................................................................................................................................... 8
实验二 数据库表 ........................................................................................................................... 9
【思考题】 ............................................................................................................................... 9
1......................................................................................................................................... 9 2......................................................................................................................................... 9 3. ..................................................................................................................................... 9 4. ..................................................................................................................................... 9 4....................................................................................................................................... 10
实验三 数据操作 ......................................................................................................................... 14
【实验题】 ............................................................................................................................. 14
1. .................................................................................................................................... 14 2. .................................................................................................................................... 14 3....................................................................................................................................... 14 4. .................................................................................................................................... 19 5. .................................................................................................................................... 19 6. .................................................................................................................................... 20 7. .................................................................................................................................... 20
实验四 完整性约束 ..................................................................................................................... 21
【实验题】 ............................................................................................................................. 21
1. .................................................................................................................................... 21 2. .................................................................................................................................... 21 3....................................................................................................................................... 21 4.略 .................................................................................................................................. 25 【思考题】 ............................................................................................................................. 25
1. .................................................................................................................................... 25 2. .................................................................................................................................... 26 3....................................................................................................................................... 27 4. .................................................................................................................................... 28
实验五 索引 ................................................................................................................................. 28
【实验题】 ............................................................................................................................. 28
1. .................................................................................................................................... 28 2. .................................................................................................................................... 29 3. .................................................................................................................................... 29 【思考题】 ............................................................................................................................. 29
1. .................................................................................................................................... 29 2. . .................................................................................................................................... 29 3. ................................................................................................................................... 30
实验六 视图 ................................................................................................................................. 30
【实验题】 ............................................................................................................................. 30
1. ................................................................................................................................... 31 2....................................................................................................................................... 31 3. ................................................................................................................................... 31 4. ................................................................................................................................... 33 5. ................................................................................................................................... 34 6. ................................................................................................................................... 34 7. ................................................................................................................................... 34 8. ................................................................................................................................... 35 【思考题】 ............................................................................................................................. 35
1. .................................................................................................................................... 35 2. .................................................................................................................................... 35 3. .................................................................................................................................... 36 4....................................................................................................................................... 36
试验七 数据查询 ......................................................................................................................... 38
【实验题】 ............................................................................................................................. 38
1. .................................................................................................................................... 38 2. .................................................................................................................................... 38 3. .................................................................................................................................... 39 4. .................................................................................................................................... 39 5. .................................................................................................................................... 39 6. .................................................................................................................................... 40 7. .................................................................................................................................... 40 8. .................................................................................................................................... 41 9. .................................................................................................................................... 41 10. .................................................................................................................................. 42 11. .................................................................................................................................. 42 12. .................................................................................................................................. 43 【思考题】 ............................................................................................................................. 43
1. .................................................................................................................................... 43 2. .................................................................................................................................... 44 3. .................................................................................................................................... 45 4....................................................................................................................................... 45
实验 八 存储过程 ....................................................................................................................... 45
【实验题】 ............................................................................................................................. 45
1. .................................................................................................................................... 45 2. .................................................................................................................................... 47 3. .................................................................................................................................... 48 4. .................................................................................................................................... 50 5. .................................................................................................................................... 51