Zum Inhalt

Normalisierung

Normalisierung

Autor: Lars Hellstern
Datum: 25.11.2025
Version: 1.0

Schritt: 1. Normalform (1NF)

In der 1NF entfernen wir mehrere Werte in einer Zelle (z. B. mehrere Hauptdarsteller oder Genres) und erstellen separate Zeilen.
Film_ID Titel Jahr Regisseur Regisseur_Telefon Hauptdarsteller Genre
1 Der Pate 1972 Francis Ford Coppola 0123-456789 Marlon Brando Drama
1 Der Pate 1972 Francis Ford Coppola 0123-456789 Al Pacino Krimi
2 Inception 2010 Christopher Nolan 0987-654321 Leonardo DiCaprio Sci-Fi
2 Inception 2010 Christopher Nolan 0987-654321 Leonardo DiCaprio Thriller
3 Pulp Fiction 1994 Quentin Tarantino 0456-789012 John Travolta Drama
3 Pulp Fiction 1994 Quentin Tarantino 0456-789012 Uma Thurman Krimi
4 Titanic 1997 James Cameron 0123-456789 Leonardo DiCaprio Drama
4 Titanic 1997 James Cameron 0123-456789 Kate Winslet Romantik
5 The Dark Knight 2008 Christopher Nolan 0987-654321 Christian Bale Action
5 The Dark Knight 2008 Christopher Nolan 0987-654321 Heath Ledger Drama

Schritt: 2. Normalform (2NF)

In der 2NF entfernen wir funktionale Abhängigkeiten, indem wir die Tabelle in mehrere Tabellen aufteilen.

Ein Beispiel: Die Telefonnummer eines Regisseurs hängt nur von Regisseur, nicht von Film_ID ab.

Tabelle 1: Filme

Film_ID Titel Jahr Regisseur_ID
1 Der Pate 1972 1
2 Inception 2010 2
3 Pulp Fiction 1994 3
4 Titanic 1997 4
5 The Dark Knight 2008 2

Tabelle 2: Regisseure

Regisseur_ID Regisseur Regisseur_Telefon
1 Francis Ford Coppola 0123-456789
2 Christopher Nolan 0987-654321
3 Quentin Tarantino 0456-789012
4 James Cameron 0123-456789

Tabelle 3: Hauptdarsteller

Hauptdarsteller_ID Film_ID Hauptdarsteller
1 1 Marlon Brando
2 1 Al Pacino
3 2 Leonardo DiCaprio
4 3 John Travolta
5 3 Uma Thurman
6 4 Leonardo DiCaprio
7 4 Kate Winslet
8 5 Christian Bale
9 5 Heath Ledger

Tabelle 4: Genres

Genre_ID Film_ID Genre
1 1 Drama
2 1 Krimi
3 2 Sci-Fi
4 2 Thriller
5 3 Drama
6 3 Krimi
7 4 Drama
8 4 Romantik
9 5 Action
10 5 Drama

Schritt: 3. Normalform (3NF)

In der 3NF stellen wir sicher, dass keine transitiven Abhängigkeiten existieren. Das Modell ist nun in der 3NF, da:
  • Alle nicht-schlüsselabhängigen Attribute direkt vom Primärschlüssel abhängen.
  • Die Tabelle in der 2NF ist.

3. Normalform als Mermaid-Diagramm:

erDiagram

FILM {
  int Film_ID PK
  string Titel
  int Jahr
  int Regisseur_ID FK
}

REGISSEUR {
  int Regisseur_ID PK
  string Name
  string Telefon
}

HAUPTDARSTELLER {
  int Hauptdarsteller_ID PK
  int Film_ID FK
  string Name
}

GENRE {
  int Genre_ID PK
  int Film_ID FK
  string Bezeichnung
}

REGISSEUR ||--o{ FILM : dreht
FILM ||--o{ HAUPTDARSTELLER : hat
FILM ||--o{ GENRE : hat