Is it possible to create a composite primary key using a foreign key?
I have the table mov_estoque
, where I thought of putting id_mov
and id_prod
as the composite key, however, id_prod
is a foreign key of the products table.
I tried:
ALTER TABLE mov_estoque
DROP PRIMARY KEY, ADD PRIMARY KEY (id,id_pro);
But I get:
1832 - Can not change column 'id_pro': used in a foreign key constraint 'mov_estoque_ibfk_2'