阿神2017-04-17 14:48:10
I have done such a simple design before, but it depends on your needs.
1. User table
id, name
For example data:
1, Zhang San
2, Wang Er
2. Friend table
id, u_id, c_id
For example, data
1,1,2 (representative) Zhang San plus Wang Er
2,2,1 Wang Er plus Zhang San
Relatively simple idea, I hope it will be helpful to you.
PHPz2017-04-17 14:48:10
If the volume is small, it is okay to only use a relational database. If the volume is large, you have to consider non-relational ones, such as graph databases