I am new to this database SQL language so I will try to make it as simple as possible. (I am using MySQL Workbench)

I have a table for User and I want multiple users to be friends with each other. For that I created the friends table where it has a user\_id and friend\_user\_id. So let's say we have (1,2), (2,3). I want this to be read as: "2 is friends with 1 and 3, 1 is friends with 2, 3 is friends with 2". So when inserting on this friends table I never do something like this (1,2),(2,1). I'm looking for a procedure that by receiving an user\_id as parameter to return all his friends whether they are in the user\_id column or the friend\_user\_id column. For example, if I look for user 2's friends it should appear 1 column with 1 and 3, because 1 and 3 are friends with 2.

To be more specific, when I call get\_friends(2) it should appear

```
[1]
[3]

```

Even though these are in different columns on the friends table.