Sql-server – How to ensure each user only answers a question once on the db side

database-designsql server

I am designing a database for a custom software application. The part I am focused on now is the ability to add custom questions to ask users.

I want to ensure that each user can only answer a question once. In this case, a user is a 'Provider'. How do I ensure each user only answers a question once?

database mockup

Best Answer

A unique constraint on Answers (questionid, providerid) was needed, as suggested by Balazs Papp.

As explicitly pointed out by Andriy M this should be a composite key.

I had to look up composite keys, as I was unfamiliar. Thanks so much to everyone for helping and responding so quickly.