douji5329 2011-10-07 09:16
浏览 136
已采纳

什么更快,选择多行还是多列?

I'm creating a invoice system and I'm not creating a config table where all the system settings are located. I was wonder how to insert the settings. Here's what I'm wondering:

Config Table (with columns)

config1 config2 config3 config4
-------------------------------
1       2       gtm     2

Config Table (with rows)

config      value
-----------------
config1     1
config2     2
config3     gtm
config4     2

Any recommendations?

  • 写回答

2条回答 默认 最新

  • drryyiuib43562604 2011-10-07 09:19
    关注

    The second option is far better for the purposes of data structure, it allows more sophisticated querying (what if you ever wished to do a JOIN with option #1?), data mining etc. It also allows better extensibility, you should look at the columns being the denominators of your data, and your rows being RAW INFORMATION. Without the column header, you would not be able to interpret the raw data on its own, and/or it variability.

    Look at it like this, for one thing- if you wished to add a new config- the overhead of doing so in option#1 is less practical than with option#2. You would need to add a new column in your table, then (likely) update all your SQL statements that reference the table to be aware there is a new column. If you add a new config in option#2, it is merely a new row, your table structure remains the same so your implementation of it within your code remains unchanged.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用