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
Yes. Create a primary key on both itemId and userId.
To do this in T-SQL (SQL Server) you would use something like:
(This assumes your items table is ‘item’ and your users table is ‘user’.)
I’m not sure why you have a value for both thumbs up and thumbs down? If this is a boolean value, you might only need one: if thumbs up is 0, then that’s effectively thumbs down anyway.
Edit: Definition of composite keys
When you create a primary key on two columns in one table, that means it is only required to be unique for both values, i.e. it will allow for any number of rows with the same itemId as long as each userId is different, and vice-versa.
It’s the combination of the two that must be unique, not each part of the key individually.