faecher:informatik:oberstufe:datenbanken:normalisierung:1_normalform:start

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
faecher:informatik:oberstufe:datenbanken:normalisierung:1_normalform:start [26.11.2020 10:48] – [1. Normalform (1NF)] sbelfaecher:informatik:oberstufe:datenbanken:normalisierung:1_normalform:start [08.02.2024 07:45] (aktuell) – alte Version wiederhergestellt (08.02.2024 08:40) Frank Schiebel
Zeile 67: Zeile 67:
  
 ++++ Lösung Schritt 2 | ++++ Lösung Schritt 2 |
 +<wrap hi>Achtung! Reihenfolge - warum?</wrap>
 <code sql> <code sql>
 UPDATE zahnarztbedarf SET plz = SUBSTRING_INDEX(TRIM(wohnort), ' ', 1) UPDATE zahnarztbedarf SET plz = SUBSTRING_INDEX(TRIM(wohnort), ' ', 1)
Zeile 72: Zeile 73:
 </code> </code>
  
 +++++
 +
 +++++ In einem (komplizierteren) Schritt | 
 +Man kann das auch direkt machen, indem man die folgende Anweisung entsprechend für alle 4 Informationen anpasst:
 +<code sql>
 +UPDATE zahnarztbedarf SET ort=SUBSTRING_INDEX(TRIM(SUBSTRING_INDEX(adresse, ',', -1)), ' ', -1); 
 +</code>
 ++++ ++++
  
Zeile 80: Zeile 88:
 ++++ Lösung |  ++++ Lösung | 
  
-4 neue Tabellenfelder:+4 neue Tabellenfelder: ''firma'', ''f_strasse'', ''f_plz'', ''f_ort''
  
 <code sql> <code sql>
Zeile 99: Zeile 107:
 UPDATE zahnarztbedarf SET f_strasse = SUBSTRING_INDEX(SUBSTRING_INDEX(hersteller, ',' , 2), ',' , -1) UPDATE zahnarztbedarf SET f_strasse = SUBSTRING_INDEX(SUBSTRING_INDEX(hersteller, ',' , 2), ',' , -1)
 UPDATE zahnarztbedarf SET f_ort = SUBSTRING_INDEX(hersteller, ',', -1) UPDATE zahnarztbedarf SET f_ort = SUBSTRING_INDEX(hersteller, ',', -1)
-UPDATE zahnarztbedarf SET f_plz = SUBSTRING_INDEX(TRIM(ort), ',', 1) +UPDATE zahnarztbedarf SET f_plz = SUBSTRING_INDEX(TRIM(ort), ' ', 1) 
-UPDATE zahnarztbedarf SET f_ort = SUBSTRING_INDEX(TRIM(ort), ',', -1)+UPDATE zahnarztbedarf SET f_ort = SUBSTRING_INDEX(TRIM(ort), ' ', -1)
 </code> </code>
  
  • faecher/informatik/oberstufe/datenbanken/normalisierung/1_normalform/start.1606387706.txt.gz
  • Zuletzt geändert: 26.11.2020 10:48
  • von sbel