Last answered:

18 Sept 2023

Posted on:

13 Sept 2023

0

Error while executing the ALTER query

I followed the same query as shown in the video but I am facing an error stating "Error Code: 1822. Failed to add the foreign key constraint. Missing index for constraint 'sales_ibfk_1' in the referenced table 'customers' ", What does this mean and how can I solve it?

2 answers ( 0 marked as helpful)
Posted on:

13 Sept 2023

0

Problem solved, Adding a primary key (customer_id) while creating customers table.

Instructor
Posted on:

18 Sept 2023

0

Hi Sai!
Thanks for reaching out.


Yes, you have to add a primary key customer_id in the customers table. This resolves the issue.


Hope this helps.
Best,
Tsvetelin

Submit an answer