如何将异常(插入、删除和更新)引入到 Oracle 数据库中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18961118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:56:39  来源:igfitidea点击:

How can anomalies (insertion,deletion and updation) be introduced into Oracle database?

databaseoracle

提问by Mistu4u

I was trying to learn Normalization in Oracle database, but struck in understanding the problem for which normalization is the solution i.e. I am unable to understand different anomalies (insertion,deletion and updation) properly. Not that, I do not know anything about them; I learned the theory from my text book (Navathe & Elmsari). Anomaly is the problem raised in a database during these processes and result in inconsistent database. But I can not properly visualize it i.e. how can anomalies get introduced in the database. So, it will be very helpful if somebody comes up with a really simple database example and help me understand how can these anomalies be introduced in the database. I tried to find in the internet, but could not find good examples.

我试图在 Oracle 数据库中学习规范化,但突然明白了规范化是解决方案的问题,即我无法正确理解不同的异常(插入、删除和更新)。并非如此,我对他们一无所知;我从我的教科书 (Navathe & Elmsari) 中学到了这个理论。异常是在这些过程中数据库出现的问题,导致数据库不一致。但我无法正确地将其可视化,即如何在数据库中引入异常。因此,如果有人提出一个非常简单的数据库示例并帮助我理解如何在数据库中引入这些异常,这将非常有帮助。我试图在互联网上找到,但找不到好的例子。

回答by Premraj

Anamoly: difficult to classify

Anamoly:难以分类

enter image description here

在此处输入图片说明

The Problems resulting from data redundancy in an un-normalized database table are collectively known as update anomalies. So any database insertion, deletion or modification that leaves the database in an inconsistent state is said to have caused an update anomaly. They are classified as

非规范化数据库表中的数据冗余导致的问题统称为更新异常。因此,任何使数据库处于不一致状态的数据库插入、删除或修改都被称为导致更新异常。它们被归类为

Insertion anomalies:To insert the details of a new member of staff located at branch B1 into the Tbl_Staff_Branch Table shown above, we must enter the correct details of branch numner B1 so that the branch details are consistent with the values for branch B1 in other rows. To insert the details of a new branch that currently has no members of staff into the Tbl_Staff_Branch table, it is necessory to enter nulls for the staff details which is not allowed as staffID is the primary key. But if you normalize Tbl_Staff_Branch, which is in Second Normal Form (2NF) to Third Normal Dorm (3NF), you end up with Tbl_Staff and Tbl_Branch and you shouldn't have the problems mentioned above.

插入异常:要将位于分支 B1 的新员工的详细信息插入到上面所示的 Tbl_Staff_Branch 表中,我们必须输入正确的分支编号 B1 的详细信息,以便分支详细信息与其他行中分支 B1 的值一致. 要将当前没有员工的新分行的详细信息插入到 Tbl_Staff_Branch 表中,必须为员工详细信息输入空值,这是不允许的,因为员工 ID 是主键。但是如果你将第二范式 (2NF) 的 Tbl_Staff_Branch 归一化为第三范式 (3NF),你最终会得到 Tbl_Staff 和 Tbl_Branch,你不应该有上面提到的问题。

Deletion anomalies:If we delete a row from the Tbl_Staff_Branch table that represents the last member of staff located at that branch, (for e.g. row with Branch numbers B",B3 or B4) the detals about that branch are also lost from the Database.

删除异常:如果我们从 Tbl_Staff_Branch 表中删除代表位于该分行的最后一名员工的行,(例如,分行编号为 B"、B3 或 B4 的行)有关该分行的详细信息也会从数据库中丢失。

Modification anomalies:Should we need to change the address of a particular branch in the Tbl_Staff_Branch table, we must update the rows of all staff located at that branch. If this modification is not carried out on all the relevant rows, the database will become inconsistent.

修改异常:如果我们需要更改 Tbl_Staff_Branch 表中特定分行的地址,我们必须更新位于该分行的所有员工的行。如果没有对所有相关行进行这种修改,数据库就会变得不一致。

Read more: http://www.mahipalreddy.com/dbdesign/dbqa.htm#update

阅读更多:http: //www.mahipalreddy.com/dbdesign/dbqa.htm#update