วันจันทร์ที่ 2 เมษายน พ.ศ. 2561

wk12 : form

First form
จาก table employee
จะเห็นว่า มี Jon และ Lester มี 2 เบอร์
จึงไม่เป็น 1st form จากกฏคือ “each attribute of a table must have atomic (single) values”
จึงต้องทำให้ตารางเป็นดังนี้
(แยกเบอร์ออกมา)

Second form
มีกฏดังนี้
  • table จะต้องเป็น first form ก่อน
  • ต้องไม่มี non-prime attribute ที่ขึ้นอยู่กับ subsets of candidate key ของ table
non-prime attribute คือ attribute ที่ไม่ใช่ candidate keys

ยกตัวอย่าง ครูสอนวิชา
จากตัวอย่างจะเห็นว่า teacher_age ขึ้นอยู่กับ teacher_id (เป็น candidate keys) เพียงตัวเดียว

ดังนั้น ต้องแยกตารางเป็นดังนี้ 


Third form

  • Table จะต้องเป็น 2NF
  • ต้องไม่มี Transitive functional dependency ของ non-prime attribute บน super key ใดๆ
จากตารางจะเห็นว่า emp_zip ขึ้นอยู่กับ emp_id
และ emp_state,emp_city,_emp_distirict ขึ้นอยู่กับ emp_zip
จึงเกิด Transitive functional dependency (emp_zip เป็น non-prime attribute)

ทำการแยกตารางเพื่อไม่ให้เกิด Transitive functional dependency



ref: https://beginnersbook.com/2015/05/normalization-in-dbms/


wk12 : form

First form จาก table employee จะเห็นว่า มี Jon และ Lester มี 2 เบอร์ จึงไม่เป็น 1st form จากกฏคือ  “each attribute of a table must ha...