Here's the problem I need to deal with:
I have a table persons [ID, Name, LastName..] . Now I need to save friendships among multiple users. I can't figure out any elegant and maintainable solution. Any ideas?
Asked
Active
Viewed 150 times
0
user2285265
- 123
- 1
- 2
- 7
-
1make a new table friendship, with two fields, friendof and friedID. – Sumit Gupta Oct 16 '13 at 12:31
-
The `persons` table holds information about individuals. Now i need to save information about people how know each other. Let's say they meet each other on the trip. – user2285265 Oct 16 '13 at 12:34
-
If I got you correctly.. here are some duplicates http://dba.stackexchange.com/questions/10199/how-should-i-design-a-relationship-table-for-friendship . http://stackoverflow.com/questions/3009190/mysql-friends-table – Zerotoinfinity Oct 16 '13 at 12:42
-
http://stackoverflow.com/questions/379236/database-design-best-table-structure-for-capturing-the-user-friend-relationship & http://stackoverflow.com/questions/4219979/sql-best-practise-for-a-friendship-table and trust me there are so many similar questions on SO – Zerotoinfinity Oct 16 '13 at 12:43
1 Answers
0
Solution 1(Recommended)
- Table-persons with columns [ID, Name, LastName..]
- Table-Fiends with Columns [ID, P.ID]
Solution 2
- Table-persons with columns [ID, Name, LastName, FriendID(ID)] Self-Referencing column
M.Ali
- 67,945
- 13
- 101
- 127