设计数据库的正确方法 [英] The right way in designing a database

查看:117
本文介绍了设计数据库的正确方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始了我的第一个MySQL专案,设计 ERD,逻辑和实体图

I started my first MySQL project designing the ERD, logical and physical diagrams.

我的一个朋友正在和我做同一个项目。我通过做一个ERD,然后规范化我的数据库的计划。

A friend of mine is making the same project as me. I started the plan of my databases by making an ERD and then normalizing.

然而,他使用关系数据库图表,他在设计接口和其他部分之前先制作ERD。他例如只将堆栈写入列语句,而不是创建帮助表。他说最好先做接口,然后做ERD。

However, he uses a relational database diagrams where he designs interfaces and other parts first before making the ERD. He for example writes "stack" only to the column phonenumbers, instead of making a "help-table".He says that it is best to make the interfaces first and then make the ERD.

我们中哪一个在你看来更好?

Which one of us is doing the plan in your opinion better?

推荐答案

但是,一般来说,我通常做的是

However to generalise what I would generally do is


  1. 分析您的数据并将其减少到第三个正常形式。

  2. 鉴于数据的可能业务使用决定了数据是否应该被非规范化。通常,大多数数据库将在第三级正常中占绝对优势,但有一些关键例外。
  3. 鉴于上述情况,可能需要创建任何其他索引,或修改现有主索引(应在阶段1中分配) 。
  4. 根据需要创建用户访问权限的视图。

  5. 创建您需要的任何过程,以及可能的触发器(例如,一般最好避免,但适合用于审计目的)。

  1. Analyse your data and reduce it down to 3rd normal form. This should be pretty formulaic to accomplish.
  2. In light of likely business use of the data decide if and where data should be denormalized. Typically most databases will be overwhelmingly in 3rd normal with a few critical exceptions. This part is where experience and craft come in.
  3. In light of the above create any additional indexes that may be necessary, or modify existing primary indexes (which should have been assigned in phase 1).
  4. Create views for user access as necessary. The number you require may vary from none (as in simple embedded application) to many (as in no direct data access to tables allowed).
  5. Create any procedures you need, and possibly triggers (generally best avoided but appropriate for audit purposes).

在实践中,过程当然是更多的迭代,数据到接口保持真实。此外,在设计数据库时,请记住,您希望以后更改它,并尽可能尝试做一个相当简单的任务,这是一个好主意。

In practice of course the process is considerably more iterative, but the general design path from data to interface holds true. Also it's a good idea when designing a database to keep in mind that you will want to change it later and try if possible to make that a reasonably straightforward task.

这篇关于设计数据库的正确方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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