在mysql中创建表的问题 [英] problem in creating a table in mysql

查看:84
本文介绍了在mysql中创建表的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我创建它创建的城市表,但是当我创建第二个表时,它显示该错误..
我不明白..请有人知道..



first i create a city table it created,but when i create the 2nd table it shows that error..
i didnt understand..please somebody having any idea..



[SQL] CREATE TABLE `area` (
`id`  int(11) NOT NULL AUTO_INCREMENT ,
`name`  varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
`city_id`  int(11) NULL DEFAULT NULL ,
PRIMARY KEY (`id`),
FOREIGN KEY(`city_id`) REFERENCES city (id) 
)
ENGINE=INNODB
DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci
AUTO_INCREMENT=1
CHECKSUM=0
ROW_FORMAT=DYNAMIC
DELAY_KEY_WRITE=0
;



[Err] 1005 - Can''t create table ''virtualmarket.area'' (errno: 150)



[Err] 1005 - Can''t create table ''virtualmarket.area'' (errno: 150)

推荐答案

考虑安装city表拳头,因为city具有外键,而您的后面的表则依赖于此值..
consider installing city table fist as city has an foreign key and your later table depends on this values..


这篇关于在mysql中创建表的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆