Can't create table

I have to tables
Employee(id,firstname,middlename,lastname,function)
Function(id,description)


Im trying to create foreign key on Employye in field function but i get the following error:

Can't create table '.\mydb\#sql-e28_8.frm' (Error: 150)

Employee.function has same data type with Function.ID.
Table types are InnoDB.
AlbvisionAsked:
Who is Participating?
 
lokusConnect With a Mentor Commented:
Error 150 is foreign key error.
Do a SHOW INNODB STATUS and you can search for the foreign key error, you will get a better details of the error.
0
 
racekCommented:
first - create index on Employe(fuunction) and then can you continue with FK creation...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.