Example: Let's say we have a friends table with columns user_id, friend_id, status. We need to be able to add:
| user_id | friend_id | status |
|---|---|---|
| 3 | 1 | False |
| 3 | 2 | False |
| 3 | 4 | False |
But it was impossible to add:
| user_id | friend_id | status |
|---|---|---|
| 1 | 3 | False |
| 2 | 3 | False |
| 4 | 3 | False |
In other words, so that IDs 1 and 2, 1 and 3 can be added and their reflections 2 and 1, 3 and 1 cannot be added.
Thank you in advance
I tried to make a composite key of user_id and friend_id consisting of foreign keys referencing to the same table. I also tried. I also tried to make these values unique, but in this case I can't add duplicates; for example 1 and 2, 1 and 3 (not added).