//user: id name password
how to properly make friends system?
how should look table friends?
USERID | FRIENDID
user1id | user2id, user3id
user2id | user1id, user4id, user6id
user3id
user4id | user2id
for example point?
or
USERID | FRIENDIS
user1id | user2id
user1id | user3id
user2id | user1id
user2id | user4id
etc
?
thanks
Those kind of tables are named relations or association tables.
A table built of 2 foreign keys to provide a many to many relationship. Your last example is exactly what you’re looking for. Those comma-seperated stuff is worst practice!
EDIT: Some additional strategies!
You want to get both the “isFriendOf” (where the user is in your column “FRIENDS”) and “hasFriend” (where the user is in your column “USERID”) and compare those two.
More Details? ;D