编辑: 人间点评 | 2017-10-02 |
db_Exam'
) drop database db_Exam go DECLARE @device_directory NVARCHAR(520) SELECT @device_directory = '
D:\'
EXECUTE (N'
CREATE DATABASE db_Exam ON PRIMARY (NAME = N'
'
db_Exam'
'
, FILENAME = N'
'
'
+ @device_directory + N'
db_Exam.mdf'
'
) LOG ON (NAME = N'
'
db_Exam_log'
'
, FILENAME = N'
'
'
+ @device_directory + N'
db_Exam.ldf'
'
)'
) go use db_Exam go CREATE DEFAULT Question AS '
求学的地方'
go CREATE DEFAULT answer AS '
蔡家关'
go CREATE RULE ProName AS @col IN ('
地理信息系统'
, '
土地资源管理'
, '
岩土工程'
, '
水文水资源'
, '
环境工程'
, '
环境科学'
, '
勘查技术与资源'
) go CREATE RULE Lesson AS @col IN ('
地理信息系统原理'
, '
地图学'
, '
遥感原理与应用'
, '
数据库原理'
) go CREATE RULE type AS @col IN ('
单选'
, '
多选'
, '
判断'
) go CREATE RULE Score AS @col BETWEEN
0 AND
100 Go CREATE TABLE tb_Administrator ( ID bigint IDENTITY (1,1) , Name varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL , PWD varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL , JoinTime datetime NULL CONSTRAINT DF_tb_Administrator_JoinTime DEFAULT getdate() ) go ALTER TABLE tb_Administrator ADD CONSTRAINT PK_tb_Administrator PRIMARY KEY CLUSTERED (ID ASC) go CREATE TABLE tb_Lesson ( ID bigint IDENTITY (1,1) , Name varchar(60) COLLATE Chinese_PRC_CI_AS NULL , ofProfession bigint NULL , JoinTime datetime NULL CONSTRAINT DF_tb_Lesson_JoinTime DEFAULT getdate() ) go ALTER TABLE tb_Lesson ADD CONSTRAINT PK_tb_Lesson PRIMARY KEY CLUSTERED (ID ASC) go CREATE TABLE tb_Profession ( ID bigint IDENTITY (1,1) , Name varchar(200) COLLATE Chinese_PRC_CI_AS NULL , JoinTime datetime NULL CONSTRAINT DF_tb_Profession_JoinTime DEFAULT getdate() ) go ALTER TABLE tb_Profession ADD CONSTRAINT PK_tb_Profession PRIMARY KEY CLUSTERED (ID ASC) go CREATE TABLE tb_Questions ( id bigint IDENTITY (1,1) , que_subject varchar(50) COLLATE Chinese_PRC_CI_AS NULL , que_type char(10) COLLATE Chinese_PRC_CI_AS NULL , que_joindate datetime NULL CONSTRAINT DF_tb_Questions_que_joindate DEFAULT getdate(), optionA varchar(50) COLLATE Chinese_PRC_CI_AS NULL , optionB varchar(50) COLLATE Chinese_PRC_CI_AS NULL , optionC varchar(50) COLLATE Chinese_PRC_CI_AS NULL , optionD varchar(50) COLLATE Chinese_PRC_CI_AS NULL , que_answer char(10) COLLATE Chinese_PRC_CI_AS NULL , note varchar(50) COLLATE Chinese_PRC_CI_AS NULL , Que_TaotiID bigint NULL , Que_LessonID bigint NULL , Que_ProfessionID bigint NULL ) go ALTER TABLE tb_Questions ADD CONSTRAINT PK_tb_Questions PRIMARY KEY CLUSTERED (id ASC) go CREATE TABLE tb_Student ( ID varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL , Name varchar(20) COLLATE Chinese_PRC_CI_AS NULL , PWD varchar(20) COLLATE Chinese_PRC_CI_AS NULL , Sex varchar(2) COLLATE Chinese_PRC_CI_AS NULL , JoinTime datetime NULL CONSTRAINT DF_tb_student_JoinTime DEFAULT getdate(), question varchar(50) COLLATE Chinese_PRC_CI_AS NULL , answer varchar(50) COLLATE Chinese_PRC_CI_AS NULL , profession bigint NULL , IPAddress char(30) COLLATE Chinese_PRC_CI_AS NULL ) go ALTER TABLE tb_Student ADD CONSTRAINT PK_tb_S........