I have a room_tb table and seller table. I want create a fk.
ALTER TABLE seller
ADD CONSTRAINT fk_romid
FOREIGN KEY (roomID)
REFERENCES room_tb(roomID)
roomID is primary key in my room_tb table and is autoincrement.
roomID is simple integer with same characters as roomID in room_tb but is not autoincrement.
I am getting error:
1452 - Cannot add or update a child row: a foreign key constraint fails (
iwant2.<result 2 when explaining filename '#sql-13ec_2c7'>, CONSTRAINTfk_romidFOREIGN KEY (roomID) REFERENCESroom_tb(roomID))
What have I done wrong?