PROBLEM: In a table; column 1 is not unique for same value of column 2 but column 1 value is unique over different values of column 2. How can this condition be implemented in postgreSQL db.
Explaination
Assume table 1 exists in DB
Table 1
Column A | Column B | Extra |
---|---|---|
One | apple | green |
One | apple | blue |
Two | apple | pink |
Three | orange | purple |
for Column B as "apple" if in Column A value "One" exists, then for any other value of Column B, Column A will not have "One".
Example: element from Table 2 Should NOT Exist
Table2
Column A | Column B | Extra |
---|---|---|
One | orange | red |
**the Extra column can have any value