I have a table that keeps the user ratings for items. I want to allow each user to rate an item only once, is there any way to force the database not to allow duplicate for itemId and userId?
I don't want each individual field to be a primary key. I want the primary key to be based on both of them at the same time. for example there is a row:
itemId= 1 & userId = 1
following should be allowed:
itemId= 2 & userId = 1
itemId= 1 & userId = 2
following should NOT be allowed:
itemId= 1 & userId = 1