1创建一个存储过程,当工资大于8000的,工资减一成,否则加一成工资
2建立一个函数,输入学生学号,返回成绩
student(id,name,score)
3查询员工的工资,当工资大于2000时,显示该工资
但工资低于2000,则加200元工资,然后再输出
4求1+2+....+i,一直加到总和>6000,并求出此时i的值
5建立一个存储过程,给全班的同学加2分,一直加到有同学100分为止
6财务把小王和小李的工资搞反了,请你写一个存储过程,把小王和小李的工资反过来
7SQLserver 表students(id ,name,score)
查找成绩排在前百分之20的学生信息
8删除一张表的两种语句
9为表emp的age增加一个约束,让其范围在18-40之间
10建立一个SQL用户,用户名sa,密码SC
5.declare @score
while(score>100)
begin
select @score=score from emp
@score=@score+2
update emp set score=@score
select score from emp order by desc
if()
end
declare @money
select @money=money from emp where name='小李'
update emp set money=(select money from emp where name='小王')
where name='小李'
update emp set money=@money where name='小王'
drop table emp
alter table emp
add constraint ck_age check(age between 18 and 40)
select id,name,score top 20 percent from student
order by score desc
exec sp_addlogin 'sa','sc'
1.declare @sal
declare @name
set @name='张三'
select @sal=sal from emp where name=@name
if(@sal>8000)
begin
@sal=sal*0.9
update emp set sal=@sal where name=@name
end
else
begin
@sal=sal*1.1
update emp set sal=@sal where name=@name
end
go
3.declare @sal
while(true)
begin
select @sal=sal from emp
if(@sal>2000)
begin
print ‘该号工工资为:'+@sal
end
else
begin
@sal=@sal+200
update emp set sal=@sal
print ‘该号工工资为:'+@sal
end
end
4.declare @i:=1
declare @sum:=0
begin
while(@sum>6000)
begin
@sum=@sum+@i
@i++
end
print '此时的i值为:'+@i
end