[Business Intelligence] 1NF, 2NF, 3NF

(1) Functional Dependency

an attribute determines other attribute's value
eg:
  Full FD:
  (studentID) determine (studentName) 
  Partially FD:
  (studentID,studentName) determine (score)

(2) Key

 Student(stuID,name,HKID,sex,score)

 Superkey: 一系列屬性
 eg:(stuID),(HKID),(stuID,HKID),(stuID,HKID,name)....
    These superkeys can determine the identity.

 Key: minimal supterkey 最小的superkey
 eg:(stuID),(HKID)

 Candidate Key: 沒有多餘屬性
 eg:(stuID),(HKID),(name)

 Primary Key: 主鍵
 Secondary Key: Candidate Key中除了PK

(3) 1NF

     First normal form 

     only have simple value
     一個屬性不可有多值+無重複列

Problem:
這裏寫圖片描述

Solution:
這裏寫圖片描述


(4) 2NF

  every non-prime attribute is fully FD on the PK
  清除部分依賴 應該完全依賴 (僅一個PK)

Problem:

這裏寫圖片描述

這裏寫圖片描述

Solution:

變爲2NF 也是3NF
這裏寫圖片描述


(5) 3NF

No non-prime attribute is transitively dependent on the PK
沒有傳遞依賴關係

Problem:

這裏寫圖片描述

傳遞依賴
這裏寫圖片描述

Solution:

這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章