I want to create a table with two columns: user_id
, image_id
.
I don't want user_id
or image_id
to be unique, but I also want to protect my table from duplicate pairs of same user_id
and image_id
. Can I do that?
Add a separate constraint for both columns:
CREATE TABLE MyTable(
user_id INTEGER,
image_id INTEGER,
[...],
UNIQUE(user_id, image_id)
)