如何在同一SQL列中存储多个值 [英] How to Store multiple values in same SQL column
问题描述
我想创建一个问答应用程序,例如堆栈溢出.
I want to create a Questions and answers application like stack overflow.
我不知道如何在MySQL表列中存储多个答案.
I do not know how to store multiple answers in MySQL table column.
我想知道如何在sql表的同一行中存储问题和多个答案.
I want to know how to store questions and multiple answers in same row in the sql table.
推荐答案
创建两个表并使用外键关系进行连接是最好的解决方案之一. 因为将问题和答案保存在同一表格中可能不会使您对同一问题有多个答案.如果您希望一个问题有多个答案,那么数据库的冗余肯定会增加.因此,请尝试正确使用DB-Relationship概念.
Creating two tables and connecting them using foreign key relationship is one of the best solutions. Because keeping questions and answers in a same table may not allow you to have multiple answers for the same questions. If you want a single question to have multiple answers then the redundancy of your DB will surely increase. So, try to use DB-Relationship concepts properly.
这篇关于如何在同一SQL列中存储多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!