Best way to apply a "friend system"-like table? I am making a website that has multiplayer games like chess, poker, etc.

Users will be able to add friends. I was thinking about how could I make this relationship in the database, and I thought of two methods:

1 - Using a row for every friendship
e.g

id   |   friend1   |   friend2


2 - Using only a row per user, adding all friends in a string separated by comma (in a text field maybe?) e.g

|id   |   user    |   friends                |
----------------------------------------------
|1    |    rellfy |   user1,user2,user3,user4|


What would be the best method to use? Using a string only, and parsing it later through the application, or querying for friends directly?
First approach is the SQL approach. You need to make modification though. The relation that you are describing is called many to many - each player can have each other player as friend. To achieve this you need a separate table which connects player with his friends (you just need 2 IDs):

|Player_ID  | Friend_ID|
------------------------
|  1        |  2       |
|  1        |  5       |


This is the better approach if you need make a lot of queries on Player and list of his friends (this will give speed of queries).

If you just need list of names, the other approach is also possible.

So you have to think and decide which is better approach for your needs.