mysql创建表时 报[Err] 1005 - Can't create table 'ajax.county' (errno: 150)错误
createtablesheng(sheng_idintprimarykeynotnullcomment'省份编号',sheng_namechar(100)notnull...
create table sheng(
sheng_id int primary key not null comment '省份编号',
sheng_name char(100) not null comment '省份的名称'
);
#创建城市表
create table city(
sheng_id int not null comment '省份编号',
city_id int not null comment '城市编号',
city_name char(100) not null comment '城市名称',
constraint foreign key (sheng_id) references sheng (sheng_id),
primary key(sheng_id,city_id)
);
#创建县城表
create table county(
city_id int not null comment '城市编号',
county_id int not null comment '县城编号',
county_name char(100) not null comment '县城名称',
constraint foreign key (city_id) references city(city_id),
primary key(city_id,county_id)
);
各位大哥 帮帮忙啊 小弟在线等候啊 在此感谢了 展开
sheng_id int primary key not null comment '省份编号',
sheng_name char(100) not null comment '省份的名称'
);
#创建城市表
create table city(
sheng_id int not null comment '省份编号',
city_id int not null comment '城市编号',
city_name char(100) not null comment '城市名称',
constraint foreign key (sheng_id) references sheng (sheng_id),
primary key(sheng_id,city_id)
);
#创建县城表
create table county(
city_id int not null comment '城市编号',
county_id int not null comment '县城编号',
county_name char(100) not null comment '县城名称',
constraint foreign key (city_id) references city(city_id),
primary key(city_id,county_id)
);
各位大哥 帮帮忙啊 小弟在线等候啊 在此感谢了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |