use student_data
select *from S
select *from C
select *from SC
--使用游标查询s表中男生信息
declare youbiao scroll cursor--定义
for select* from S
where sgender='男'
--释放游标
--deallocate youbiao
open youbiao--打开游标
fetch last from youbiao--读取最后一行
fetch first from youbiao--读取第一行
fetch absolute 5 from youbiao--读取第五行
fetch relative 3/*后三行-3*/from youbiao--读取当前记录位置前后三行
CLOSE YOUBIAO
deallocate youbiao
declare CS_CURSOR scroll cursor--定义
for select sno,sname,sgender from S
where college='计算机系'
open CS_CURSOR
fetch absolute 2 from CS_CURSOR--读取第2行
update S
set sname='123456',sgender='女'
where current of CS_CURSOR
CLOSE CS_CURSOR
deallocate CS_CURSOR
sql游标
最新推荐文章于 2024-10-06 06:56:01 发布