mysql数据库,建表语句在客户端命令行中执行没问题,但是在phpadmin中执行报错,烦死我了,谁快来帮帮我?
uselaiyangwen;createtableteacher(idintauto_incrementprimarykey,index(id),namevarchar(...
use laiyangwen;
create table teacher
(
id int auto_increment primary key ,
index (id),
name varchar(250),
pwd varchar(250)
)type=innodb ;
insert into teacher values(0,'admin','123');
create table grade
(
id int auto_increment primary key,
index (id),
gradeName varchar(250)
)type=innodb ;
insert into grade values(0,'一年级');
insert into grade values(0,'二年级');
create table stuclass
(
id int auto_increment primary key,
index (id),
className varchar(250)
)type=innodb ;
insert into stuclass values(0,'001');
insert into stuclass values(0,'002');
create table student
(
id int auto_increment primary key,
index (id),
gradeId int,
index (gradeId),
foreign key (gradeId) references grade(id) on delete cascade,
classId int,
index(classId),
foreign key (classId) references stuclass(id) on delete cascade,
name varchar(250),
sex varchar(250),
age int,
pwd varchar(250)
)type=innodb ;
insert into student values(0,1,1,'张三11','男',18,'123');
insert into student values(0,1,1,'李四11','男',19,'123');
insert into student values(0,1,1,'王五12','男',18,'123');
create table question
(
id int auto_increment primary key,
index (id),
`type` varchar(250),
kemu varchar(250),
question varchar(250),
A varchar(250),
B varchar(250),
C varchar(250),
D varchar(250),
answer varchar(250),
nandu varchar(250)
)type=innodb ;
create table paper
(
id int auto_increment primary key,
index (id),
paperName varchar(250),
questionId int,
index(questionId),
foreign key (questionId) references question(id) on delete cascade,
createTime datetime,
paperAuthor int ,
index(paperAuthor),
foreign key (paperAuthor) references teacher(id) on delete cascade
)type=innodb ;
create table exam
(
id int auto_increment primary key,
index (id),
paperName varchar(250),
gradeId int,
index(gradeId),
foreign key (gradeId) references Grade(id) on delete cascade,
stuclassId int,
index(stuclassId),
foreign key (stuclassId) references Stuclass(id) on delete cascade,
flag varchar(250),
createTime datetime
)type=innodb ;
create table examRecord
(
id int auto_increment primary key,
index (id),
examId int,
index(examId),
foreign key (examId) references exam(id) on delete cascade,
stuId int,
index (stuId),
foreign key (stuId) references student(id) ,
questionId int,
index(questionId),
foreign key (questionId) references question(id) on delete cascade,
answer varchar(250),
score int ,
isTrue varchar(250),
remark varchar(250),
createTime datetime
)type=innodb ; 展开
create table teacher
(
id int auto_increment primary key ,
index (id),
name varchar(250),
pwd varchar(250)
)type=innodb ;
insert into teacher values(0,'admin','123');
create table grade
(
id int auto_increment primary key,
index (id),
gradeName varchar(250)
)type=innodb ;
insert into grade values(0,'一年级');
insert into grade values(0,'二年级');
create table stuclass
(
id int auto_increment primary key,
index (id),
className varchar(250)
)type=innodb ;
insert into stuclass values(0,'001');
insert into stuclass values(0,'002');
create table student
(
id int auto_increment primary key,
index (id),
gradeId int,
index (gradeId),
foreign key (gradeId) references grade(id) on delete cascade,
classId int,
index(classId),
foreign key (classId) references stuclass(id) on delete cascade,
name varchar(250),
sex varchar(250),
age int,
pwd varchar(250)
)type=innodb ;
insert into student values(0,1,1,'张三11','男',18,'123');
insert into student values(0,1,1,'李四11','男',19,'123');
insert into student values(0,1,1,'王五12','男',18,'123');
create table question
(
id int auto_increment primary key,
index (id),
`type` varchar(250),
kemu varchar(250),
question varchar(250),
A varchar(250),
B varchar(250),
C varchar(250),
D varchar(250),
answer varchar(250),
nandu varchar(250)
)type=innodb ;
create table paper
(
id int auto_increment primary key,
index (id),
paperName varchar(250),
questionId int,
index(questionId),
foreign key (questionId) references question(id) on delete cascade,
createTime datetime,
paperAuthor int ,
index(paperAuthor),
foreign key (paperAuthor) references teacher(id) on delete cascade
)type=innodb ;
create table exam
(
id int auto_increment primary key,
index (id),
paperName varchar(250),
gradeId int,
index(gradeId),
foreign key (gradeId) references Grade(id) on delete cascade,
stuclassId int,
index(stuclassId),
foreign key (stuclassId) references Stuclass(id) on delete cascade,
flag varchar(250),
createTime datetime
)type=innodb ;
create table examRecord
(
id int auto_increment primary key,
index (id),
examId int,
index(examId),
foreign key (examId) references exam(id) on delete cascade,
stuId int,
index (stuId),
foreign key (stuId) references student(id) ,
questionId int,
index(questionId),
foreign key (questionId) references question(id) on delete cascade,
answer varchar(250),
score int ,
isTrue varchar(250),
remark varchar(250),
createTime datetime
)type=innodb ; 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |