CREATE TABLE Permission (
permissionID INTEGER PRIMARY KEY UNIQUE,
user INTEGER
location INTEGER
);
I don't want to have user or location to be UNIQUE
because I can have multiple rows with user containing the same data, or multiple rows with location containing the same data. I just want to avoid having both user and location having some value, with that row repeating any number of times.
Ex: this is okay
permissionID user location
--------------------------
1 1 2
2 2 2
3 2 1
but this is not okay:
permissionID user location
--------------------------
1 1 2
2 1 2
because a row already exists in which user = 1 and location = 2.
How can I avoid duplicates?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…