Add foreign key on existing table in Sequel Pro

206 Views Asked by At

I have two existing table A and B. A have 1000 rows and B have 100 rows.

I want to change one of the column on table B to be the foreign key which will reference to the the id (primary key) in table A.

However, the SQL query alter table <table B> add foreign key (<column in table B>) references <table A>(id) does not work in Sequel Pro, and the error message is Cannot add foreign key constraint.

Do anyone know why?

0

There are 0 best solutions below