I have a database table with columns "User","Role"
and"Application"
.
My requirement is that a user can only have one role but he can belong to multiple applications. I will want add this restriction in form of a constraint but i am not able to achieve it.
Setting unique constraint on "user" and "role" will not help. Also setting unique constraint on all 3 columns will also not help.
Can anyone suggest on how to set constraint here.
Edit1:
Following is the expected out:
User Role Application
U1 R1 A1
U1 R1 A2
U2 R2 A3
and so on... what i want to restrict is that now that U1 has been mapped to R1, U1 should not be mapped to any other Role.