问题描述
我在过去的经验中看到,大多数人不使用表格中的物理关系,他们试图记住它们并通过编码只应用它们。
I have seen in my past experience that most of the people don't use physical relationships in tables and they try to remember them and apply them through coding only.
这里的物理关系指主键,外键,检查约束等。
在设计数据库时,人们尝试在纸上标准化数据库,并保存文档。喜欢,如果我要为营销公司创建一个数据库,我会尽力理解它的要求。
例如,什么字段是必填字段,哪些字段只包含(a或b或c)等。
While designing a database, people try to normalize the database on paper and keep things documented. Like, if I have to create a database for a marketing company, I will try to understand its requirements.For example, what fields are mandatory, what fields will contain only (a or b or c) etc.
当所有的事情都清楚时,
When all the things are clear, then why are most of the people afraid of the constraints?
- 他们不想管理事情吗?
- 他们缺乏知识
(我不这么认为)? - 他们对未来的
问题不满意吗? - 管理所有这些实体真的是一项艰难的工作吗?
- Don't they want to manage things?
- Do they have a lack of knowledge(which I don't think is so)?
- Are they not confident about futureproblems?
- Is it really a tough job managing all these entities?
您认为是什么原因?
推荐答案
我始终有DBMS强制实施主键和外键约束;我经常添加检查约束。就我而言,数据太重要,不能运行存储不准确数据的风险。
I always have the DBMS enforce both primary key and foreign key constraints; I often add check constraints too. As far as I am concerned, the data is too important to run the risk of inaccurate data being stored.
如果你认为数据库是一系列存储的真逻辑命题,你会看到,如果数据库包含假命题 - 错误 - 那么你可以争论任何你想要的结论。假设一个假的前提,任何结论都是真的。
If you think of the database as a series of stored true logical propositions, you will see that if the database contains a false proposition - an error - then you can argue to any conclusion you want. Given a false premise, any conclusion is true.
为什么其他人不使用PK和FK约束等?
Why don't other people use PK and FK constraints, etc?
有些人不知道它们的重要性(因此缺乏知识绝对是一个因素,甚至是一个主要因素)。其他人害怕,他们将花费太多的性能,忘记一个错误,必须修复可能会容易地使用了所有的时间节省了没有DBMS做检查你。我认为如果当前DBMS无法处理它们,它可能是(可能是)时间更改DBMS。
Some are unaware of their importance (so lack of knowledge is definitely a factor, even a major factor). Others are scared that they will cost too much in performance, forgetting that one error that has to be fixed may easily use up all the time saved by not having the DBMS do the checking for you. I take the view that if the current DBMS can't handle them well, it might be (probably is) time to change DBMS.
这篇关于数据库设计:艺术或头痛(管理关系)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!