📄 10db.txt
字号:
--create proc hyproc1 as
--select *
--from 职工
--where 工资>1800
--execute hyproc1
--use 企业销售管理系统
--select *
--from 职工
--where 工资>1800
--execute hyproc1
--create proc hyproc1 as
--select *
--from 职工
--where 工资>1800
--create proc hyproc2
--@mingz int,
--@maxgz int
--as
--select *
--from 职工
--where 工资 between @mingz and @maxgz
--execute hyproc2 1900,2500
--create proc hyproc3
--@changkuhao varchar(50),
--@maxgz int output,
--@avggz int output
--as
--begin
-- select * from 职工 where 仓库号=@changkuhao
-- select @maxgz=max(工资) from 职工 where 仓库号=@changkuhao
-- select @avggz=avg(工资) from 职工 where 仓库号=@changkuhao
--
--end
--declare @x1 int,@x2 real
--execute hyproc3 'wh3',@x1 output,@x2 output
--select @x1 as wh1职工最大工资,@x2 as wh1职工平均工资
--alter proc hyproc3
--@changkuhao varchar(50),
--@maxgz int output,
--@avggz real output
--as
--begin
-- select * from 职工 where 仓库号=@changkuhao
-- select @maxgz=count(工资) from 职工 where 仓库号=@changkuhao
-- select @avggz=sum(工资) from 职工 where 仓库号=@changkuhao
--end
declare @x1 int,@x2 real
execute hyproc3 'wh1',@x1 output,@x2 output
select @x1 as wh1仓库职工人员,@x2 as wh1仓库职工工资和
--execute sp_rename hyproc3,newproc1
--drop proc hyproc1,hyproc2
--alter proc zfproc1
--@x1 int,
--@x2 int,
--@x3 int
--as
--begin
-- declare @max int
-- if @x1>@x2
-- set @max=@x1
-- else
-- set @max=@x2
-- if @x3>@max
-- set @max=@x3
--print '三个数中最大的数是:'+cast(@max as varchar(50))
--end
--execute zfproc1 1546,32654,123123
----drop proc hyproc1
--create proc zfproc2
--@x int
--as
--begin
-- declare @i int,@cj int,@sum int
--select @i=1,@cj=1,@sum=0
--while @i<=@x
-- begin
-- set @cj=@cj*@i
-- set @sum=@sum+@cj
-- set @i=@i+1
-- end
-- print cast(@x as varchar(50))+'阶乘之和是:'+cast(@sum as varchar(50))
--end
execute zfproc2 5
----use hystu
----select *
----from hyuser1
--
--alter proc logon
--@hyuser varchar(50),
--@hypsd varchar(50)
--as
--begin
--declare @msg varchar(50)
--if exists(select * from hyuser1 where hyname=@hyuser)
-- begin
-- if exists(select * from hyuser1 where hypsd=@hypsd and hyname=@hyuser)
-- set @msg='用户名与密码输入正确,成功登录!'
-- else
-- set @msg='密码不正确,请重新输入密码!'
-- end
--else
-- set @msg='用户名不正确,请重新输入用户名!'
--print @msg
--
--end
----select *
----from hyuser1
execute logon 'stu','1111'
--create proc zfproc
--@zghao varchar(30),
--@ckhao varchar(30),
--@sname varchar(50),
--@sex varchar(10),
--@gz int
--as
--begin
-- if exists(select * from 职工 where 职工号=@zghao)
-- print '该职工已经存在,请自重新输入职工号!'
-- else
--
-- begin
-- if exists(select * from 仓库 where 仓库号=@ckhao)
-- begin
-- insert into 职工(职工号,仓库号,姓名,性别,工资) values(@zghao,@ckhao,@sname,@sex,@gz)
-- print '成功插入一条记录'
-- end
-- else
-- print '你输入的仓库号不合法,请重新输入仓库号!'
-- end
--end
select *
from 职工
--delete from 职工 where 姓名='张平'
--use 企业销售管理系统
----execute zfproc 'zg20','wh3','张平','女',1350
--select *
--from 职工
--delete from 职工 where 职工号='zg20'
--create proc zfproc5
--@zghao varchar(50)
--as
-- begin
-- if exists(select *from 职工 where 职工号=@zghao)
-- begin
-- if exists(select * from 订购单 where 职工号=@zghao)
-- begin
-- delete from 订购单 where 职工号=@zghao
-- print '该职工有订单,并成功删除!'
-- end
-- else
-- print '该职工没有订单!'
-- delete from 职工 where 职工号=@zghao
-- print '删除该职工的信息!'
--
-- end
-- else
-- print '该职工不存在,请重新输入职工号'
-- end
--execute zfproc5 'zg1'
select *
from 订购单
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -