SQL数据库语言的使用.doc
《SQL数据库语言的使用.doc》由会员分享,可在线阅读,更多相关《SQL数据库语言的使用.doc(7页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateSQL数据库语言的使用11 在 xk数据库中创建一个名为p_studentt的存储过程,该存储过程要求返回student表中所有班级代码为20000001的记录。Create procedure p_studentAsSelect * from student where classno=200000012 在 xk数据库中创建一个名为p_studentpara的存储
2、过程,该存储过程能根据给定的班级返回该班级代码对应的student表中的记录。create procedure p_studentpara classno varchar(8)asselect * from student where classno=classnoexec p_studentpara classno=20000001goexec p_studentpara classno=20000002go3.创建存储过程p_classnum,要求能够根据用户给定的班级代码,统计该班的人数,并将人数以输出变量返回给用户。parameter_name datatype=default out
3、putcreate procedure p_classnumclassno varchar(8),classnum smallint outputasset classnum=(select count (*) from studentwhere classno=classno)print classnum测试语句:declare classno varchar (8),classnum smallintset classno=20000001exec p_classnum classno,classnum output4.修改Alter 修改存储过程p_studentpara,使其能根据用户提供的班级名称,而不是班级代码进行模糊查询,并且要求加密。alter procedure p_studentparaclassname varchar(20)with encryptionasselect classname,stuno,stuname,pwdfrom student ,classwhere student.classno=class.classnoand classname like%+classname+%5.系统过程Exec sp_addlogin student01goexec sp_addlogin student02,02go-
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SQL 数据库 语言 使用
限制150内