sql面试题中经常出现一张学生表,表字段有学生ID,学生课程,学生成绩
今天要实测,so,需要有数据,now,随机生成数据,,,
1 create table student 2 ( 3 id varchar(50), --编号 4 class varchar(50),--课程 5 soure int --成绩 6 ) 7 go 8 9 declare @i int 10 set @i = 0 11 12 while @i<30 13 begin 14 15 --插入数据 16 declare @r int 17 exec awf_RandInt 50,100,@r output 18 insert into student values(''+@i,'语文',@r) 19 20 --修改数据 21 exec awf_RandInt 0,30,@r output 22 update student set class = '数学' where id = @r+'' 23 24 --修改数据 25 exec awf_RandInt 0,30,@r output 26 update student set class = '英语' where id = @r+'' 27 28 29 set @i=@i+1 30 end 31 select * from student