create DATABASE testOnline
use testOnline
-- 用户表
create table users(
uid int PRIMARY KEY IDENTITY(1,1),
uname varchar(20) not null,
pwd varchar(32) not null,
puser int DEFAULT 0,
utype int DEFAULT 0
)
insert into users (uname,pwd) values ('admins','123456')
-- 题库表
create table question(
qid int PRIMARY KEY identity(1,1),
qtitle varchar(100) not null,
qanser varchar(10) not null,
optionA varchar(100) not null,
optionB varchar(100) not null,
optionC varchar(100) not null,
optionD varchar(100) not null,
qLesson varchar(20) ,
qtype varchar(10) DEFAULT('单选题')
)
drop table tests
-- 试卷表
create table tests(
tid int PRIMARY key identity(1,1),
tname varchar(20) not null,
tstartTime datetime ,
tendTime datetime ,
tqid varchar(200),
tuids varchar(200),
tnum int not null,
tAllTime int ,
tState int DEFAULT 0,
tuid int not null
)
-- 答题表
create table ansers(
aid int PRIMARY key identity(1,1),
tid int not null,
uid int not null,
astartTime datetime,
aendTime datetime,
anserArr varchar(100),
score DECIMAL(3,2) DEFAULT 0
)
-- 错题表
create table errorQues(
eid int PRIMARY KEY identity(1,1),
uid int not null,
tid int not null,
qid int not null,
eanser varchar(100),
addTime datetime
)