I have a table “friends” with “user1” and “user2” columns.
How can I remove duplicate relationships?
For example, if I already have
user1=1 and user2=3,
how can I remove user1=3 and user2=1 values?
Could I enforce that in MySQL with a unique index?
With this query you can find duplicate relationships
I recommend put the lower userId for user1 and create a unique index