In my problem, i have two columns in my 'Person' database. One column stores the group the person belongs to and a column which stores that he is the admin of the group. Once group can have only one admin.
My thought is that i should put a unique contraint on both of the columns. But the problem is that for the other users which are not admins they unique contraint gets broken.
What should be the proper solution of he problem.
Example Database
----------------------------------
Person_id | Group_Id | Is_admin
----------------------------------
1 | 9 | null
2 | 9 | null
3 | 9 | null
4 | 9 | 1
5 | 9 | null
6 | 4 | null
7 | 4 | null
8 | 4 | null
9 | 4 | 1
Now if I apply unique contraint on Group_Id and Is_admin they are unique but not in the case when the person is not an admin.