create table approval
(
app_id smallint not null,
visitor_id smallint(5),
approve varchar(5),
primary key (app_id) auto increment
foreign key (visitor_id) references trans_req_visitor(visitor_id)
constraint approval check (approval in ('TRUE', 'FALSE'))
);
我找不到导致错误的地方,我在哪里弄错了?
答案 0 :(得分:1)
之后缺少逗号
primary key (app_id) auto increment
将您的查询更改为
create table approval(
app_id smallint not null,
visitor_id smallint(5),
approve varchar(5),
primary key (app_id) auto_increment,
FOREIGN KEY (visitor_id) REFERENCES trans_req_visitor(visitor_id),
constraint approval check (approval in ('TRUE', 'FALSE'))
);
答案 1 :(得分:1)
auto increment
和REFERENCES trans_req_visitor(visitor_id)
试试这个
create table approval(
app_id smallint not null AUTO_INCREMENT,
visitor_id smallint(5),
approve varchar(5),
primary key (app_id),
FOREIGN KEY (visitor_id) REFERENCES trans_req_visitor(visitor_id),
constraint approval check (approval in ('TRUE', 'FALSE'))
);
答案 2 :(得分:1)
你需要这样做:
create table approval(
app_id smallint not null auto_increment,
visitor_id smallint(5),
approve varchar(5),
primary key (app_id),
FOREIGN KEY (visitor_id) REFERENCES trans_req_visitor(visitor_id),
constraint approval check (approval in ('TRUE', 'FALSE'))
);
(错过逗号,错误输入和错位auto_increment
)
注意 check
。出于兼容性原因,此语法仅允许 。