What is important to keep in mind when designing a

2020-02-19 06:56发布

What is important to keep in mind when designing a database?

I don't want to limit your answer to my needs as I am sure that others can benefit from your insights as well. But I am planning a content management system for a multi-client community driven site.

23条回答
我命由我不由天
2楼-- · 2020-02-19 07:23

Make sure you use constraints (CHECK, NOT NULL, FOREIGN KEY, PRIMARY KEY, and DEFAULT) to ensure that only correct data is stored in the database in the first place. You can always buy faster hardware but you cannot buy more correct data.

查看更多
再贱就再见
3楼-- · 2020-02-19 07:23

"Thumb rule of Databases - Down Always Beats Across!"

Examples: If you have a Customer table with columns for Mailing Address and Shipping address and Billing address... Create a separate CustomerAddress table with an Address Type

If you have a CancellationDetails table with CancellationReason01, CancellationReason02, CancellationReason03.. create a separate CancellationReason table

查看更多
smile是对你的礼貌
4楼-- · 2020-02-19 07:26

Establish consistent naming standards up-front. It will save several minutes of unnecessary thinking in the long run. (This may read as irony, but I am serious.)

And don't abbreviate anything, unless it is extremely common. Don't turn the database into a license-plate message guessing game. It's amazing what becomes not-obvious after a year.

查看更多
神经病院院长
5楼-- · 2020-02-19 07:28

As much as you can make primary key a sequence generated number.

查看更多
欢心
6楼-- · 2020-02-19 07:28

I agree that knowing about your data is good and normalizing.

Something else I would suggest is to keep very large text fiels in a separate table. For example, if you have a contract you might want to keep a lot of the information about the contract in one table but keep the legal (and very large) document in a separate table. Just put in an index from the main table into the legal document.

查看更多
够拽才男人
7楼-- · 2020-02-19 07:33

Try to imagine the SQL queries that you will preform against it.

This is important because you will do it A LOT!

查看更多
登录 后发表回答