MySQL Forums
Forum List  »  Newbie

mySql Table creation Issue
Posted by: Nalini Sritharan
Date: January 07, 2015 12:16AM

I have a table called ums_grad_list with the description
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| sno | int(11) | NO | PRI | NULL | auto_increment |
| grad | varchar(10) | YES | | NULL | |
+-------+-------------+------+-----+---------+----------------+
and another table called ums_bloodgroup_list with the description
+------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+----------------+
| sno | int(11) | NO | PRI | NULL | auto_increment |
| bloodgroup | varchar(10) | YES | | NULL | |
+------------+-------------+------+-----+---------+----------------+

I am trying to create a new table called ums_user_data with reference to the above 2 tables.

create table ums_user_data(regno int(15) AUTO_INCREMENT, fname varchar(20), lname varchar(20), dob date, grad_sno int(11), bloodgroup_sno int(11), gender varchar(6), PRIMARY KEY(regno), FOREIGN KEY(grad_sno) REFERENCES ums_grad_list(sno), FOREIGN KEY(bloodgroup_sno) REFERENCES ums_bloodgroup_list(sno));

I am unable to create the table using the above query. When executing the query i'm getting the below error.

ERROR 1005 (HY000): Can't create table 'user_management_system.ums_user_data' (errno: 150)

What could be the reason for the error? I have checked the data type and size were exactly matching.

Note: The table ums_user_data was exist before and got deleted unexpectedly. Now the table does not exist.

Options: ReplyQuote


Subject
Written By
Posted
mySql Table creation Issue
January 07, 2015 12:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.