SQL数据库语言的使用.doc

上传人:wj 文档编号:1215394 上传时间:2023-04-30 格式:DOC 页数:3 大小:15KB
下载 相关 举报
SQL数据库语言的使用.doc_第1页
第1页 / 共3页
SQL数据库语言的使用.doc_第2页
第2页 / 共3页
SQL数据库语言的使用.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

SQL数据库语言的使用.doc

《SQL数据库语言的使用.doc》由会员分享,可在线阅读,更多相关《SQL数据库语言的使用.doc(3页珍藏版)》请在冰点文库上搜索。

SQL数据库语言的使用.doc

1.在xk数据库中创建一个名为p_studentt的存储过程,该存储过程要求返回student表中所有班级代码为20000001的记录。

Createprocedurep_student

As

Select*fromstudentwhereclassno=’20000001’

2.在xk数据库中创建一个名为p_studentpara的存储过程,该存储过程能根据给定的班级返回该班级代码对应的student表中的记录。

createprocedurep_studentpara

@classnovarchar(8)

as

select*fromstudentwhereclassno=@classno

execp_studentpara@classno='20000001'

go

execp_studentpara@classno='20000002'

go

3.创建存储过程p_classnum,要求能够根据用户给定的班级代码,统计该班的人数,并将人数以输出变量返回给用户。

@parameter_namedatatype=[default]output

createprocedurep_classnum

@classnovarchar(8),@classnumsmallintoutput

as

set@classnum=(selectcount(*)fromstudent

whereclassno=@classno

print@classnum

测试语句:

declare@classnovarchar(8),@classnumsmallint

set@classno='20000001'

execp_classnum@classno,@classnumoutput

4.修改

Alter

修改存储过程p_studentpara,使其能根据用户提供的班级名称,而不是班级代码进行模糊查询,并且要求加密。

alterprocedurep_studentpara

@classnamevarchar(20)

withencryption

as

selectclassname,stuno,stuname,pwd

fromstudent,class

wherestudent.classno=class.classno

andclassnamelike'%'+@classname+'%'

5.系统过程

Execsp_addlogin'student01'

go

execsp_addlogin'student02','02'

go

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2