Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
modul:m290_guko:learningunits:lu07:theorie:c_update [2025/09/28 20:00] – gkoch | modul:m290_guko:learningunits:lu07:theorie:c_update [2025/09/28 20:09] (aktuell) – gkoch | ||
---|---|---|---|
Zeile 4: | Zeile 4: | ||
Wichtig: Immer mit einer Bedingung (%%WHERE%%) einschränken, | Wichtig: Immer mit einer Bedingung (%%WHERE%%) einschränken, | ||
- | ===== Syntax ===== | ||
- | **Mit Filter | + | ===== UPDATE Statement ===== |
+ | **Syntax | ||
<WRAP center box 80% round>< | <WRAP center box 80% round>< | ||
UPDATE tabellenname | UPDATE tabellenname | ||
Zeile 13: | Zeile 13: | ||
</ | </ | ||
- | **Ohne Filter | + | **Syntax |
<WRAP center box 80% round>< | <WRAP center box 80% round>< | ||
UPDATE tabellenname | UPDATE tabellenname | ||
Zeile 19: | Zeile 19: | ||
</ | </ | ||
- | ===== Beispiele ===== | ||
- | **Gezielt ändern | + | **Ausgangstabelle: |
+ | <WRAP center box 80% round> | ||
+ | ^ film_id ^ title ^ director | ||
+ | | 1 | Lost in Translation | Sofia Coppola | ||
+ | | 2 | Inception | ||
+ | | 3 | Arrival | ||
+ | </ | ||
+ | |||
+ | **Beispiel 1: Gezieltes Update | ||
<WRAP center box 80% round>< | <WRAP center box 80% round>< | ||
UPDATE favourite_film | UPDATE favourite_film | ||
Zeile 29: | Zeile 36: | ||
<WRAP center box 80% round> | <WRAP center box 80% round> | ||
- | ^ film_id ^ title ^ director | + | ^ film_id ^ title ^ director |
- | | 1 | Lost in Translation | Sofia Coppola | + | | 1 | Lost in Translation | Sofia Coppola| 2003 | Scarlett Johansson | |
- | | 2 | Inception | + | | 2 | Inception |
- | | 3 | Arrival | + | | 3 | Arrival |
</ | </ | ||
- | **Mehrere Spalten | + | **Beispiel 2: Mehrere Spalten ändern** |
<WRAP center box 80% round>< | <WRAP center box 80% round>< | ||
UPDATE favourite_film | UPDATE favourite_film | ||
Zeile 49: | Zeile 56: | ||
</ | </ | ||
- | **Semantisches Update | + | **Beispiel 3: Semantisches Update** |
<WRAP center box 80% round>< | <WRAP center box 80% round>< | ||
UPDATE favourite_film | UPDATE favourite_film | ||
Zeile 56: | Zeile 63: | ||
</ | </ | ||
- | > **Warnung: | + | > **Warnung: |