This seems like a simple problem. However, I'm blocked.
I have 6 Product ID's: 1001
, 1002
, 1003
, 1004
, 1005
, 1006
.
In a table, I also have a list of account IDs. Each Account ID can have one of many product IDs(1-6), but no duplicates.
How do I add a constraint to allow multiple AccountID's in a table that could up to 1-6 product ID's but none of the productID's per one account could be duplicated?
Example Table :
Good Table
Account_ID ProductID
138777 100004
138777 100003
--------------
21252 100003
138778 100003
138779 100004
138780 100003
138781 100001
138782 100004
Bad table
Account_ID ProductID
138777 100003
138777 100003
---------------
21252 100003
138778 100003
138779 100004
138780 100003
138781 100001
138782 100004
What's the most logical way of implementing this constraint?