Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个包含两列的表:user_id, image_id. 我不想user_id或者image_id是独一无二的,但我也想保护我的桌子免受重复的相同user_idand对image_id。我可以这样做吗?
user_id
image_id
为两列添加单独的约束:
CREATE TABLE MyTable( user_id INTEGER, image_id INTEGER, [...], UNIQUE(user_id, image_id) )