Reputation: 5087
Sample Table
first_column second_column
1 2
In the sample table above, is there a way to make a constraint in MySQL so that inserting (2,1) would return duplicate key error?
Upvotes: 0
Views: 158
Reputation: 4489
When dealing with these kind of "pairings" I try to insert in order. Like
INSERT INTO blah (one, two) VALUES (?, ?)
params += min(one, two)
params += max(one, two)
Of course this doesn't answer your question of how to set a constraint.
Upvotes: 2