Reputation: 1201
I have the following table:
I must set a rule in that entity, so you can't have the same home_account_user_id
and same account_status
twice for example:
id | home_account_user_id | account_status
0 | 1 | AWAY
0 | 1 | AWAY
Should be:
id | home_account_user_id | account_status
0 | 1 | AWAY
0 | 1 | CLOSED
Is there a way to define it this way?
Upvotes: 1
Views: 468
Reputation: 175924
You could use UNIQUE
constraint/index:
CREATE UNIQUE INDEX udx_name ON tab_name(home_account_user_id, account_status);
Upvotes: 1