Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
[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)
Posted
Updated 8-Nov-11 19:20pm
v2
Comments
Mehdi Gholam 9-Nov-11 1:35am    
Have you created the city table first?

1 solution

consider installing city table fist as city has an foreign key and your later table depends on this values..
 
Share this answer
 
Comments
Denno.Secqtinstien 22-Nov-11 1:33am    
any comments will be appreciated

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900