Hi all,
I have a table in Db2 v8 like this:
Team Name Role
------ -------- ---------------------
A Superman Leader
A Batman Member
A WonderWoman Member
B Alvin Leader
B Peter Member
B Charlie Member
What I want to do is to ensure that
each team has one and only one Leader
The unique index on Team+Role
cannot achieve this purpose
because there are many Member records.
Functionally, what I want to do is to
have unique index on Team+Role
for those records with Role="Leader"
Is there any special method to do this in DB2
so as to enforce this constraint ?
Alvin SIU
I have a table in Db2 v8 like this:
Team Name Role
------ -------- ---------------------
A Superman Leader
A Batman Member
A WonderWoman Member
B Alvin Leader
B Peter Member
B Charlie Member
What I want to do is to ensure that
each team has one and only one Leader
The unique index on Team+Role
cannot achieve this purpose
because there are many Member records.
Functionally, what I want to do is to
have unique index on Team+Role
for those records with Role="Leader"
Is there any special method to do this in DB2
so as to enforce this constraint ?
Alvin SIU
Comment