Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SQL Abfragen

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

bin zurzeit dabei Prüfungen für die Abschlussprüfung zu lernen. Und folgende Aufgabe habe ich dort drin:

Deutschland ist in zehn Postleitzahlen (0 bis 9, 1. Stelle der PLZ) unterteilt.

Erstellen Sie eine SQL Abfrage für eine Liste, die für jede Postleitzahlregion (0 bis 9) den Gesamtumsatz ausweist. Die Liste soll nach Gesamtumsatz absteigend sortiert werden.

Beispielausgabe:

[table=width: 500, class: outer_border, align: left]

[tr]

[td]Gebiet[/td]

[td]Umsatz[/td]

[/tr]

[tr]

[td]5[/td]

[td]154.000[/td]

[/tr]

[tr]

[td]8[/td]

[td]147.000[/td]

[/tr]

[tr]

[td]4[/td]

[td]132.000[/td]

[/tr]

[tr]

[td]...[/td]

[td][/td]

[/tr]

[/table]

Hinweis: Die Kopfzeile wird nicht mit ausgegeben.

Das sortieren ist ja kein Thema, aber wie mache ich das mit diesem Umsatz?

Wäre euch dankbar wenn mir Jemand helfen könnte :)

LG

SELECT <plz-region>, SUM(<umsatz>) AS gesamtumsatz FROM tabx

GROUP BY <plz-region>

ORDER BY gesamtumsatz DESC

Du gruppierst also nach den PLZ-Regionen und summierst in diesen Regionen die Umsätze.

@Racer: Ich nehme an, dass die Aufgabe etwas komplizierter ist als das ;)

Bearbeitet von arlegermi

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.