Last answered:

22 May 2024

Posted on:

04 May 2024

0

not able to use FOREIGN KEY FUNCTION

error 1068 and error 1215 are been shown by the mysql. I tried adding Foreign key in the create table but it's giving me error



1 answers ( 0 marked as helpful)
Instructor
Posted on:

22 May 2024

0

Hi Parth!

Thanks for reaching out!

About error 1068

Somewhere in your code you are trying to create more than one primary key and this leads to the error message. In MySQL a table can have only one primary key.

About error 1215

You need to create another table and select a column to be a primary key. Then, you should make the link between these two columns. The FK is linked with a PK in another table.
 

Hope this helps.
Best,
Martin

Submit an answer