Here's an example for what I am looking to do :
I have 3 tables :
- Villages (id, name)
- Households (id, village_id)
- Persons (first_name, last_name, household_id)
I would like to make sure there isn't 2 persons who have the same first name and last name in the same village.
Basically I would like to do something of that sort :
ALTER TABLE persons
ADD UNIQUE (first_name, last_name, households.village_id
WHERE household_id=households.id)
Is there a way to do something like that ?