官术网_书友最值得收藏!

Relational schema design

In relational databases, we design with the goal of avoiding anomalies and redundancy. Anomalies can happen when we have the same information stored in multiple columns; we update one of them but not the rest and we end up with conflicting information for the same column of information. An anomaly can also happen when we cannot delete a row without losing information that we need, possibly in other rows referenced by it. Data redundancy can happen when our data is not in a normal form, but has duplicate data across different tables, which can lead to data inconsistency and is difficult to maintain.

In relational databases, we use normal forms to normalize our data. Starting from the basic 1NF (first normal form), onto the 2NF3NF, and BCNF, we model our data taking functional dependencies into account and, if we follow the rules, we can end up with many more tables than domain model objects.

In practice, relational database modeling is often driven by the structure of the data that we have. In web applications following some sort of MVC model pattern, we will model our database according to our models, which are modeled after the UML diagram conventions. Abstractions such the ORM for Django or the Active Record for Rails help application developers abstract database structure to object models. Ultimately, many times we end up designing our database based on the structure of the available data. Thus, we are designing around the answers that we can have.

主站蜘蛛池模板: 洮南市| 合山市| 黔南| 乌拉特后旗| 调兵山市| 刚察县| 广元市| 伊川县| 长阳| 德保县| 原平市| 韶关市| 开原市| 宜州市| 定结县| 江西省| 张掖市| 盘锦市| 沧州市| 古蔺县| 容城县| 云浮市| 阿克陶县| 清丰县| 余姚市| 蒙山县| 安多县| 盈江县| 垣曲县| 台东市| 彰武县| 张北县| 武威市| 诸城市| 高要市| 中牟县| 茌平县| 托克托县| 鸡泽县| 祁阳县| 泽州县|