How to design the database for the comment function of friends in social products

like Wechat"s comments on friends, when checking moments, the friend"s name will show the name of the comment, and the name of the comment will also be the name of the comment.

Mar.18,2021

come on, the remarks should be friendship ability, right? So friends always have data tables to save? So do you want to set a memo field directly in the relational table? When the data is displayed, it detects whether there is a comment for the user, and then uses it. Should it satisfy you?


needs to add a table,
field 1: the number of the user who initiated the comment,
field 2: the number of the user being commented, and
field 3: the name of the comment.

when the backend returns data, find the user list first, and then find the corresponding comment names one by one. As for how to find it, it is beyond the scope of this question, and a lot of content can not be finished


for example, the name of the author in the list of posts below and the name of the author in the comments need to be changed to comments.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdfcae-30cee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdfcae-30cee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?