我有一个这样的表格:
选项 1 - 值 1(数字)
选项 2 - 值 2(数字)
……
选项 459 - 值 459(数字)
“添加新选项”
正如你所看到的,我不知道会有多少个选项。我只知道如果通过 url 访问一个选项,我需要在每次访问时在某处加上 + 1。
我的 table 应该是什么样子......?
最佳答案
您可能想要一个“长而窄”的 table :
CREATE TABLE OptionValue (
id INT --this is a surrogate primary key. Optional, but I like to have them.
,optionGroup INT --since you have more then one set of options stored here
,optionNo INT,
,Value numeric
)
或者类似的东西。
关于mysql - 为未知数量的字段创建一张表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23208886/