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)
Problem solved, Adding a primary key (customer_id) while creating customers table.
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