In our last tutorial, we learned about the second normal form and even normalized our Score table into the 2nd Normal Form.

So let's use the same example, where we have 3 tables, StudentSubject and Score.

Student Table

Subject Table

Score Table

In the Score table, we need to store some more information, which is the exam name and total marks, so let's add 2 more columns to the Score table.

Requirements for Third Normal Form


For a table to be in the third normal form,

  1. It should be in the Second Normal form.
  2. And it should not have Transitive Dependency.

What is Transitive Dependency?

With exam_name and total_marks added to our Score table, it saves more data now. Primary key for our Score table is a composite key, which means it's made up of two attributes or columns → student_id + subject_id.

Our new column exam_name depends on both student and subject. For example, a mechanical engineering student will have Workshop exam but a computer science student won't. And for some subjects you have Prctical exams and for some you don't. So we can say that exam_name is dependent on both student_id and subject_id.

And what about our second new column total_marks? Does it depend on our Score table's primary key?

Well, the column total_marks depends on exam_name as with exam type the total score changes. For example, practicals are of less marks while theory exams are of more marks.

But, exam_name is just another column in the score table. It is not a primary key or even a part of the primary key, and total_marks depends on it.

This is Transitive Dependency. When a non-prime attribute depends on other non-prime attributes rather than depending upon the prime attributes or primary key.


How to remove Transitive Dependency?

Again the solution is very simple. Take out the columns exam_name and total_marks from Score table and put them in an Exam table and use the exam_id wherever required.

Score Table: In 3rd Normal Form

The new Exam table


Advantage of removing Transtive Dependency


The advantage of removing transtive dependency is,

  • Amount of data duplication is reduced.
  • Data integrity achieved.

数据库设计(七)第三范式(3NF)的更多相关文章

  1. BCNF/3NF 数据库设计范式简介

    数据库设计有1NF.2NF.3NF.BCNF.4NF.5NF.从左往右,越后面的数据库设计范式冗余度越低. 满足后一个设计范式也必定满足前一个设计范式. 1NF只要求每个属性是不可再分的,基本每个数据 ...

  2. 七、Oracle 数据库设计

    1. 原始单据与实体之间的关系 可以是一对一.一对多.多对多的关系.在一般情况下,它们是一对一的关系:即一张原始单据对应且只对应一个实体. 在特殊情况下,它们可能是一对多或多对一的关系,即一张原始单证 ...

  3. Oracle数据库设计第三范式

    一.数据库设计范式及其意义和不足 数据库的设计范式是数据库设计所需要满足的规范,数据库的规范化是优化表的结构和优化把数据组织到表中的方式,这样使数据更明确,更简洁.实践中,通常把一个数据库分成两个或多 ...

  4. 优化MySchool数据库设计之【巅峰对决】

    优化MySchool数据库设计 之独孤九剑 船舶停靠在港湾是很安全的,但这不是造船的目的 By:北大青鸟五道口原玉明老师 1.学习方法: 01.找一本好书 初始阶段不适合,可以放到第二个阶段,看到知识 ...

  5. 优化MySchool数据库设计总结

    数据库的设计   一:什么是数据库设计? 数据库设计就是将数据库中的数据实体以及这些数据实体之间的关系,进行规范和结构化的过程. 二:为什么要实施数据库设计? 1:良好的数据库设计可以有效的解决数据冗 ...

  6. 数据库设计范式1——三范式

    一讲到数据库设计,大家很容易想到的就是三范式,但是第四.第五范式又是什么,不是很清楚,三范式到底怎么区分,也不清楚,作为数据库设计的基础概念,我再讲解下数据库范式.   Normal form Bri ...

  7. S2--《优化MySchool数据库设计》总结

    第一章    数据库的设计 1.1  数据库设计 数据库中创建的数据库结构的种类,以及在数据实体之间建立的复杂关系是决定数据库系统效率的重要因素. 糟糕的数据库设计表现在以下两个方面: *效率低下 * ...

  8. MySQL 数据库设计 笔记与总结(2)逻辑设计

    [实例演示 —— 实体之间的关系] [逻辑设计的工作] ① 将需求转化为数据库的逻辑模型 ② 通过 ER 图的形式对逻辑模型进行展示 ③ 同所选用的具体的 DBMS 系统无关 [名词解释] 候选码可以 ...

  9. MySQL优化技巧之四(数据库设计中的一些技巧)

    1. 原始单据与实体之间的关系 可以是一对一.一对多.多对多的关系.在一般情况下,它们是一对一的关系:即一张原始单据对应且只对应一个实体.在特殊情况下,它们可能是一对多或多对一的关系,即一张原始单证对 ...

  10. SQL Server 数据库设计

    一.数据库设计的必要性 在实际的软件项目中,如果系统中需要存储的数据量比较大,需要设计的表比较多,表与表之间的关系比较复杂,那我们就需要进行规范的数据库设置.如果不经过数据库的设计,我们构建的数据库不 ...

随机推荐

  1. android 开源项目集合

    http://p.codekk.com/ http://www.apkbus.com/code.php http://androidxref.com/ https://www.androidos.ne ...

  2. UVa 164 - String Computer

    题目:编辑距离.给你两个串,将已知串转化成目标串,能够增.删.改字母,求最小操作次数. 分析:dp,编辑距离.同最大公共子序列. 注意操作位置是实时变化的. (前面都已经处理好了)           ...

  3. [Android Pro] 查看 keystore文件的签名信息 和 检查apk文件中的签名信息

    1: 查看 keystore文件的签名信息 keytool -list -v -keystore keystoreName -storepass keystorePassword 2: 检查apk文件 ...

  4. [React + Functional Programming ADT] Create Redux Middleware to Dispatch Multiple Actions

    We only have a few dispatching functions that need to be known by our React Application. Each one ac ...

  5. 让你的Photoshop编辑制作ICO格式图标文件(ICOFormat支持图标文件插件)

    相信非常多制图的朋友都喜欢用PS,可是你能用Photoshop保存为ICO格式图标文件吗?默认肯定不行.不知道是什么原因,大名鼎鼎的图像编辑软件Adobe Photoshop一直不支持导入导出ico格 ...

  6. Android模糊演示样例-RenderScript-附效果图与代码

    本文链接    http://blog.csdn.net/xiaodongrush/article/details/31031411 參考链接    Android高级模糊技术    http://s ...

  7. Android常用传感器用法一览(3)

    Android 开发包标准有8个传感器: Sensor.TYPE_ACCELEROMETER o 加速度计 (X, Y, Z) m/s2 Sensor.TYPE_GYROSCOPE o 陀螺仪 (X, ...

  8. IE下有没有类似于Firebug的调试工具

    你可以从以下网站下载firebuglite(Firebug推出的针对非火狐浏览器的调试工具) https://getfirebug.com/firebuglite   一般安装Stable chann ...

  9. 微信小程序小红点未读消息如何实现?

      如图类似的 这样的需求还挺多的,那么如何实现呢? data: { userInfo: {}, projectSource: 'https://github.com/liuxuanqiang/wec ...

  10. cordova百度地图定位Android版插件

    本插件利用百度地图提供的定位功能进行Android版手机定位. 为什么没有iOS版? 因为iOS版有官方的定位插件cordova-plugin-geolocation可以使用. 请参照:cordova ...