The Need & Rationale Spreadsheet syndrome Goal: reduce - - PowerPoint PPT Presentation

the need rationale
SMART_READER_LITE
LIVE PREVIEW

The Need & Rationale Spreadsheet syndrome Goal: reduce - - PowerPoint PPT Presentation

Introduction Good Relational Design Normalization The Need & Rationale Spreadsheet syndrome Goal: reduce redundancies and inconsistencies e ffi cient updates eliminate anomalies Normalization solves these problems Relational Database


slide-1
SLIDE 1

Introduction Good Relational Design Normalization

The Need & Rationale

Spreadsheet syndrome Goal:

reduce redundancies and inconsistencies efficient updates eliminate anomalies

Normalization solves these problems

Relational Database Design

slide-2
SLIDE 2

Introduction Good Relational Design Normalization

Normal Forms

Criteria for safety against anomalies & inconsistencies Usually 3 to 7 normal forms (1NF → 7NF)

First 3: how non-key attributes relate to key 4th & 5th: many-to-one, many-to-many Must be satisfied progressively May combine several in one step

Highest Normal Form (HNF) Applied to individual tables

Relational Database Design

slide-3
SLIDE 3

Introduction Good Relational Design Normalization

First Normal Form

A relation is a relation:

no repetition in a tuple

  • ne (at least) unique key

no nullable attribute (optional)

Atomic attribute values

For e.g., decompose multi-valued attributes

Atomicity can be extreme: date, strings

Relational Database Design

slide-4
SLIDE 4

Introduction Good Relational Design Normalization

Second Normal Form

Conditions:

Relation is in 1NF No non-prime attributes functionally depend on subset of PK

Relational Database Design

slide-5
SLIDE 5

Introduction Good Relational Design Normalization

Second Normal Form

Conditions:

Relation is in 1NF No non-prime attributes functionally depend on subset of PK

Not in 2NF:

books(book name, author name, review) skills(employee name, skill, address)

Relational Database Design

slide-6
SLIDE 6

Introduction Good Relational Design Normalization

Second Normal Form

Conditions:

Relation is in 1NF No non-prime attributes functionally depend on subset of PK

Not in 2NF:

books(book name, author name, review) skills(employee name, skill, address)

Solution: separate into multiple relations

Relational Database Design

slide-7
SLIDE 7

Introduction Good Relational Design Normalization

Second Normal Form

Conditions:

Relation is in 1NF No non-prime attributes functionally depend on subset of PK

Not in 2NF:

books(book name, author name, review) skills(employee name, skill, address)

Solution: separate into multiple relations

For e.g.: employee name, skill and employee name, address Both are in 2NF

Relational Database Design

slide-8
SLIDE 8

Introduction Good Relational Design Normalization

Second Normal Form

Conditions:

Relation is in 1NF No non-prime attributes functionally depend on subset of PK

Not in 2NF:

books(book name, author name, review) skills(employee name, skill, address)

Solution: separate into multiple relations

For e.g.: employee name, skill and employee name, address Both are in 2NF

single primary key ⇒ 2NF

Relational Database Design

slide-9
SLIDE 9

Introduction Good Relational Design Normalization

Second Normal Form

Conditions:

Relation is in 1NF No non-prime attributes functionally depend on subset of PK

Not in 2NF:

books(book name, author name, review) skills(employee name, skill, address)

Solution: separate into multiple relations

For e.g.: employee name, skill and employee name, address Both are in 2NF

single primary key ⇒ 2NF Can have anomalies in 2NF AuthorAwards(award name, award year, author name, date of birth)

Relational Database Design

slide-10
SLIDE 10

Introduction Good Relational Design Normalization

Third Normal Form

Conditions:

Relation is in 2NF Every non-key is directly dependent on the key

“every non-key attribute must provide a fact about the key, the whole key, and nothing but the key.”

Relational Database Design

slide-11
SLIDE 11

Introduction Good Relational Design Normalization

Third Normal Form

Conditions:

Relation is in 2NF Every non-key is directly dependent on the key

“every non-key attribute must provide a fact about the key, the whole key, and nothing but the key.”

AuthorAwards(award name, award year, author name, date of birth)

Relational Database Design

slide-12
SLIDE 12

Introduction Good Relational Design Normalization

Third Normal Form

Conditions:

Relation is in 2NF Every non-key is directly dependent on the key

“every non-key attribute must provide a fact about the key, the whole key, and nothing but the key.”

AuthorAwards(award name, award year, author name, date of birth) date of birth intransitively dependent on key

(author name, award year) → author name → date of birth

Solution: separate into multiple relations

AuthorAwards(award name, award year, author name) & Author(author name, date of birth)

Other examples:

Employees(Empl id, Empl name, Dept name, Dept floor) :

Relational Database Design

slide-13
SLIDE 13

Introduction Good Relational Design Normalization

Third Normal Form

Conditions:

Relation is in 2NF Every non-key is directly dependent on the key

“every non-key attribute must provide a fact about the key, the whole key, and nothing but the key.”

AuthorAwards(award name, award year, author name, date of birth) date of birth intransitively dependent on key

(author name, award year) → author name → date of birth

Solution: separate into multiple relations

AuthorAwards(award name, award year, author name) & Author(author name, date of birth)

Other examples:

Employees(Empl id, Empl name, Dept name, Dept floor) : Employees(Empl id, Empl name, Dept id) and Department(Dept id, Dept name, Dept floor)

3NF: free of update, insertion, and deletion anomalies

Relational Database Design

slide-14
SLIDE 14

Introduction Good Relational Design Normalization

Fourth Normal Form

Only many-to-one and many-to-many

Relational Database Design