I have a table with the following column:
(id, col_1, col_2)
where "id" is the primary key (auto-inc).
I would like to make col_1
and col_2
a "unique combo".
For example, if I insert the data...
(.., col_1, col_2 ) = (.., 'A', 'B')
...Next, I shouldn't be allowed to insert the following:
(.., col_1, col_2 ) = (.., 'A', 'B')
(.., col_1, col_2 ) = (.., 'B', 'A') #because it already exists, in another order:('A','B')
I successfully blocked the first case with the use of UNIQUE(col_1, col_2)
...
But it seems that the "reverse combo" (.., 'B', 'A')
is permitted.
How can I stop this?