Problem With Foreign Key
Posted by: krish S
Date: April 11, 2007 12:19AM

I gotta Problem while executing following sql. Please Help.....




drop table if exists emp_user;
drop table if exists emp_leave;

CREATE TABLE emp_user (
employee_no int(11) NOT NULL primary key auto_increment,
first_name char(30) default NULL,
midele_name char(30) default NULL,
last_name char(30) default NULL,
phone char(14) default NULL
)ENGINE=INNODB ;


CREATE TABLE emp_leave (
ID int(11) NOT NULL PRIMARY KEY auto_increment,
employee_id varchar(6) NOT NULL default '0',
ldate date default NULL,
shift varchar(10) default NULL,
reason text,
approve int(11) default NULL
)ENGINE=INNODB ;
alter table emp_leave add constraint fk_leave_1 FOREIGN KEY (employee_id) REFERENCES emp_user(employee_no);

#1005 - Can't create table './casta/#sql-3a6_a4.frm' (errno: 150)

Options: ReplyQuote


Subject
Written By
Posted
Problem With Foreign Key
April 11, 2007 12:19AM


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.