错误代码:1824。无法打开引用的表“级别”
create table users
(
user_id int auto_increment primary key not null unique ,
username varchar(50) unique null ,
email varchar(50) unique ,
passwords varchar(50) not null,
gender varchar(50) ,
login_status boolean not null
);
create table category (
category_id int primary key not null auto_increment unique ,
category_name varchar(50) not null,
category_authour varchar(50) not null,
KEY category_name_index (category_name)
);
create table theme(
id int primary key not null unique ,
image_name varchar(50) not null
-- level_number int,
-- foreign key (level_number) references levels (level_number)
);
create table questions (
question_id int primary key not null unique ,
category_name varchar(50) not null,
question_authour varchar(50) not null,
content varchar(50) not null ,
answer boolean not null,
level_number int,
KEY content_index (content),
KEY question_id_index (question_id),
foreign key (category_name) references category (category_name),
foreign key (level_number) references levels (level_number)
);
create table friends (
username int not null,
score int primary key not null,
category_name varchar(50) not null,
foreign key (question_id) references questions (question_id),
foreign key (score) references users_scores (score),
foreign key (category_name) references category (category_name)
);
create table levels (
level_id int not null primary key ,
level_number int,
KEY level_number_index (level_number)
);