• 因上次的尴尬情况,已关闭BGM自动播放
  • 这次貌似只有我一个人交作业?
  • 在这里写是为了沉淀。不然每次做的东西都不知道去哪了 (也算是一种笔记吧)
--------------创建区-----------------
create database CurriculaVariableDB
go
use CurriculaVariableDB

create table ClassInfo(
    cNo varchar(6) primary key not null, --???为什么会拿文本类型做主键?
    cName nvarchar(50) not null
)
go
create table StudentInfo(
    stuNo varchar(20) primary key not null,
    stuName nvarchar(4) not null,
    stuPwd varchar(100) default('123321'),
    stuCls varchar(6) references ClassInfo(cNo)
)
go
create table TeacherInfo(
    tID int identity(1,1) primary key,  --从这里开始没有指定数据类型,还是换回数字类型吧
    tName nvarchar(4) not null,
    tPwd varchar(100) not null

)
go
create table SubjectInfo(  --又是个宽表,造数据的时候又会头皮发麻了
    subID int identity(1,1) primary key,
    subName nvarchar(50) not null,
    subTeacher int references TeacherInfo(tID),
    subTime datetime not null,
    subRoom nvarchar(50) not null,
    subScore int not null,
    subStartDate datetime not null,
    subOverDate datetime not null,
    subMinPerson int not null,
    subPerson int not null,
    subStatic int not null,
    txt text
)
go
create table CVInfo(
    cvID int identity(1,1) primary key,
    cvStudent varchar(20) references StudentInfo(stuNo) not null,
    cvSubject int references SubjectInfo(subID) not null
)
go
create table ConfigureInfo(
    figID int identity(1,1) primary key,
    figName nvarchar(50) not null,
    figContent nvarchar(200) not null
)
go
-------------创建区完结--------------

---------------数据区----------------
----班级
insert into ClassInfo(cNo,cName) values('1704','1704班')
insert into ClassInfo(cNo,cName) values('1802','1802班')
insert into ClassInfo(cNo,cName) values('1901','1901班')
insert into ClassInfo(cNo,cName) values('1902','1902班')
insert into ClassInfo(cNo,cName) values('1903','1903班')

---学生
insert into StudentInfo(stuNo,stuName,stuCls,stuPwd) values('1','张三','1902','kjlfklfdkldfm') --滚键盘
insert into StudentInfo(stuNo,stuName,stuCls,stuPwd) values('2','李四','1901','fdf;lfd,.dl')
insert into StudentInfo(stuNo,stuName,stuCls,stuPwd) values('3','王五','1902','ygjgbvhjskfghdf')
insert into StudentInfo(stuNo,stuName,stuCls,stuPwd) values('4','赵六','1903','ghrdghhvdfdghhjgh')
insert into StudentInfo(stuNo,stuName,stuCls,stuPwd) values('5','李七','1802','hjhggftygfhgftyhh')

---教师
insert into TeacherInfo(tName,tPwd) values('顾玷纫','bvfdffdfgtgggytfcvg') --名字是自己做的生成器
insert into TeacherInfo(tName,tPwd) values('牧耱茬','gtytwgyrgdsfgttv9bjhu')
insert into TeacherInfo(tName,tPwd) values('程翦枉','6yhbnvgfgttyujhbyvvg')
insert into TeacherInfo(tName,tPwd) values('佴滂释','js67rj56tdhr76r8sttru')
insert into TeacherInfo(tName,tPwd) values('诸葛枢久','54hyjhg435yjhgdfgry')

---课程
insert into SubjectInfo(
    subName,
    subTeacher,
    subRoom,
    subScore,
    subStartDate,
    subOverDate,
    subMinPerson,
    subTime,
    subPerson,
    subStatic
    )
    select  --过于烦躁
        'gfffdfcfvhgrg',
        1,
        'gergfadsght',
        10,
        getdate(),
        getdate(),
        20,
        getdate(),
        40,
        0
    union
        select
        'sdgsafe',
        2,
        'adsgadsfew',
        20,
        getdate(),
        getdate(),
        10,
        getdate(),
        30,
        0
    union
        select
        'dsasdfed',
        3,
        'sdagsdfeds',
        30,
        getdate(),
        getdate(),
        20,
        getdate(),
        20,
        0
    union
        select
        'gefdsagv',
        4,
        'gesefewbt',
        40,
        getdate(),
        getdate(),
        40,
        getdate(),
        40,
        0


Last modification:May 6th, 2020 at 11:10 am
如果觉得我的文章对你有用,请随意赞赏