我希望创建一个朋友系统(类似于Facebook)。
我想将关系数据保存在MySql中,但我不知道哪种方式更好:
To save everysingle relationship as a single entry, such as:
id | people1 | people2 1 | john | maria 2 | john | fred 3 | maria | fred
(there i declare relationships between all of these 3 peoples)
To save everyone name and list his friends:
id | people | friends 1 | fred | mary, john 2 | mary | john, fred 3 | john | fred, mary