我是数据库和 Web 应用程序开发的新手。我想知道如何在数据库中存储特定对象的列表。例如,用户对特定帖子(对象)的评论,或特定用户的朋友或关注者列表。
通常我们以行的形式保存数据
|user_id | user_name | use_password | etc | etc
|123 | neha | 123 | ... | ...
Run Code Online (Sandbox Code Playgroud)
但在这里你不能将它们保存在行中,因为它是一个列表:
|post_142524 | comment1 | comment2 | comment3 | etc...
Run Code Online (Sandbox Code Playgroud)
你如何存储评论?我想不出为每条评论创建新列。我无法创建一个像这样按列存储数据的表:
|post_142524|
|comment1 |
|comment2 |
|comment3 |
|comment4 |
|comment5 |
etc...
Run Code Online (Sandbox Code Playgroud)
我想知道如何管理特定对象的列表。我四处搜索,但我认为我的搜索词并不完美,无法得到我想要的东西,因为我什至不知道用什么词来搜索这个问题。任何帮助,将不胜感激!