什么是创建数据库的最佳方式 [英] what is the best way to create database

查看:142
本文介绍了什么是创建数据库的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下这里的专家什么是数据库建设的最佳结构,将每张桌子分开或者将它们全部放在大桌子上





i want to ask experts here what is the best structure for database construction separate each table or reduce them all in big table


this screen shot of my database 



< img src =http://imageshack.com/a/img36/2562/hf9i。 pngwidth =800px/>


<img src="http://imageshack.com/a/img36/2562/hf9i.png" width="800px" />

推荐答案

一般情况下,你不能创建一个大表而不会对一个项目的数量设置人为限制在设计时被收容 - 这往往会浪费空间。



例如,发票不太可能成为一张大桌子的好候选人,因为那里没有必须在发票上列出的项目数量的上限或下限。只要您有一个与其他项目相关的项目,通常最好保持具有外键关系的单独表格。



唯一的时间一个大表是有意义的,如果它是扁平数据而根本没有分层元素 - 在这种情况下,为什么不只是使用大平面文件而不是数据库的复杂性?
Generally, you can't create "one big table" without placing artificial restrictions on how many of an item may be contained at design time - and that tends to waste space enourmously.

For example, an invoice is unlikely to be a good candidate for "one big table" because there is no upper or lower limit on the number of items that must be listed on an invoice. As soon as you have an item which is related to a number of other items, it is generally best to maintain separate tables with a foreign key relationship.

The only time a single big table makes sense if when it is "flat" data with no hierarchical elements at all - and in that case, why not just use a big flat file instead of teh complexity of a database?


这个问题毫无意义。这取决于要求,使用的真实数据的结构,但当然所有在大表中将完全打败关系数据库的目的和关系模型。

可能你只需要在数据库中教育自己,特别是关系数据库。例如,请参阅:

http://en.wikipedia.org/wiki/Database [ ^ ],

http://en.wikipedia.org/wiki/Relational_database [ ^ ],

http://en.wikipedia.org/wiki/Relational_model [ ^ ],

http://en.wikipedia.org/wiki/Relational_algebra [ ^ ],

< a href =http://en.wikipedia.org/wiki/Database_schema> http://en.wikipedia.org/wiki/Database_schema [ ^ ],

http://en.wikipedia.org/wiki/Database_normalization [ ^ ],

http:// en .wikipedia.org / wiki / ACID [ ^ ] 。



这只是最高级别的......我不能假装这个主题列表是全面的或足够用于任何特定目的。它只是为了给你一些想法...



-SA
The question makes no sense at all. It depends on the requirements, the structure of real data to be used, but of course "all in big table" will totally defeat the purpose of relational databases and relational model.
Probably you just need to educate yourself in databases in general, especially relational database. For example, see:
http://en.wikipedia.org/wiki/Database[^],
http://en.wikipedia.org/wiki/Relational_database[^],
http://en.wikipedia.org/wiki/Relational_model[^],
http://en.wikipedia.org/wiki/Relational_algebra[^],
http://en.wikipedia.org/wiki/Database_schema[^],
http://en.wikipedia.org/wiki/Database_normalization[^],
http://en.wikipedia.org/wiki/ACID[^].

This is just the very top level though… I cannot pretend that this list of topics is comprehensive or sufficient for any particular purpose. It just to give you some ideas…

—SA


这篇关于什么是创建数据库的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆