在设计数据库之前我应该​​注意什么?

在设计数据库之前我应该​​注意什么?

问题描述:

我想知道我应该记住(或小心)为项目设计数据库的事情吗?

i would like to know the things should i remember(or take care) to design a database for a project?

没有列表就这样,这是一种体验,就像任何事情一样。

重要的是:

1)不要过于复杂。

)不要在两个地方存储相同的数据,使用对包含实际数据的不同表的引用。

3)确保每个表都有一个ID行 - 这可以是一个如果需要,将Identity标识设置为true的整数 - 这样它就可以使每一行唯一可识别。它不占用太多空间,而且可以节省很多时间。



然后,如果你是初学者,或者不太确定手动全部尝试:

从一堆空白纸和一支铅笔开始,然后浏览用户要做的每一项功能,并在纸上进行播放。这里的想法是要准确了解您需要使用哪些数据以及如何组织良好 - 您应该发现一种方法可能会在其他地方瘫痪并使生活变得困难,或者会产生一些小的调整或额外的表格更简单。

试一试,测试它,并将论文用作数据库表。然后,当你快乐时,再做一次 - 这次是两个用户同时做事。造成问题?可以做 - 现在比以后更容易修复。



如果有,请从纸质版本设计数据库,然后再使用SSMS和可能的几个存储过程进行尝试。花在这里的时间会带来很大的好处!
There isn't a "list" as such, it's an experience thing as much as anything.
The important things are:
1) Don't over complicate it.
2) Don't store the same data in two places, use a reference to a different table that holds the actual data.
3) Make sure each table has an ID row - this can be an integer with Identity specification set to true if you want - so that it makes each row uniquely identifiable. It doesn't take much space, and it can save a lot of time.

Then, if you are a beginner, or not too sure try it all out manually:
Start with a pile of blank paper and a pencil, and go through each and every function the userhas to do and play with it on paper. The idea here is to get a firm picture of what data you need to play with and how it can be well organised - you should find that one approach falls over and makes life difficult somewhere else, or a small tweak or an extra table will make things easier.
Try it, test it, and use the paper as database tables. Then when you are happy, do it again - this time with two user doing things at the same time. Causes problems? Can do - and it's easier to fix now than later.

When you have that, design your DB from the paper version and again, try it out using SSMS and maybe a couple of stored procedures. Time spent here pays big dividends later!


有足够的最佳实践文档可以在互联网上找到,它们可以帮助你告诉你什么不该做。



其中一些是:



http://architects.dzone.com/articles/20-database-design-best [ ^ ]



http://c2.com/cgi/wiki?DatabaseBestPractices [ ^ ]



他们不会告诉你什么,事实上没有人可以告诉你什么是最适合你的申请。



我想说的是使用你的常识并尝试保持简单。在设计数据库或任何其他层时,如果您自己感觉不舒服或者您的队友不理解,那么现在是时候重新考虑您的设计了。



记住最好的设计是那些你可以向任何人解释的(我的意思是有或没有技术或功能知识的人)你正在做的事情。
There are enough best practices document which you can find on internet and they help you tell what NOT TO DO.

Some of them are:

http://architects.dzone.com/articles/20-database-design-best[^]

http://c2.com/cgi/wiki?DatabaseBestPractices[^]

What they would not tell you and in fact no one can tell you is what is best for your application.

I would say is use your common sense and try to KEEP IT SIMPLE. While designing the database or any other layer if you yourself do not feel comfortable or your team mate does not understand it then it is time to rethink about your design.

Remember the best design are those which you can explain to anyone (and I mean anyone with or without technical or functional knowledge) of what you are doing.