marks.sql

来自「数据库实验报告-web学生成绩管理系统(web查分系统)」· SQL 代码 · 共 70 行

SQL
70
字号
/* **********************************
本程序的数据库中的marks表的内容过多,且无实际意义,故实际上是通过 SQL程序自动生成的(成绩为随机数)。
*/
-----------------------------------------------------------
-------本文件内为自动填充marks表的代码--------
-----------------------------------------------------------
--select * from marks ;

/*
--------1.插入编号-----
declare @i int
set @i=1
while(@i<=360)
begin
insert into marks(编号)
values(@i)
set @i=@i+1
end
go
--------------
*/


/*

-----2.插入学号及课程号------
use marks_query
go
declare @i int,@j int
set @i=1

while(@i<=30)
  begin
update marks
set 学号=student.学号
from student,marks 
where student.编号=@i and marks.编号 between (@i-1)*12+1 and @i*12
set @j=1
while(@j<=12)
begin
update marks 
set 课程号=course.课程号
from course,marks
where course.编号=@j and marks.编号=12*(@i-1)+@j

set @j=@j+1
end
set @i=@i+1
  end
go
----------

*/
/*

-----3.插入成绩--------
declare @i int
set @i=1
while(@i<=300)
begin
update marks 
set 成绩=round(rand()*50,1)+50
where @i=编号
set @i=@i+1
end
-----------------
*/


--delete from marks

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?