Prop PropID PropDescription
Many to Many relationship
Image ImageID ImageDescription
Image_has_Prop Prop_PropID Image_ImageID
In my application, I need to insert data into the Image_has_Prop . The user types in the ImageId, and then selects the Prop from a JComboBox which displays the PropDescription field. I'm trying to figure out how to relate the description to it's foreign key, is it even possible? Because I suppose the PropDescription may not be unique. Below is my attempt, I think it is way off if Im honest, using mysql database.
INSERT INTO Image_has_Prop
(Image_ImageID, Prop_PropID)
VALUES
(Select ImageID FRom Image where ImageID ='1', SELECT PropId FROM Prop Where PropDescription = 'Tablets');