Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen SUMming values | Aggregating
SQL Basics

book
SUMming values

There is one more function that has to be implemented - function for summing values. For example, we may want to calculate the total revenue for a certain item.

To sum values in column use SUM function followed by column which values you want to sum. For our abstract example,

SELECT SUM(revenue)
FROM sells
WHERE item = 'Sofa'
123
SELECT SUM(revenue) FROM sells WHERE item = 'Sofa'
copy

Please note, that SUM function works only with numeric columns.

Aufgabe

Swipe to start coding

From the audi_cars table calculate the total tax for all RS4 cars.

Lösung

SELECT SUM(tax)
FROM audi_cars
WHERE model = 'RS4'

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 2

toggle bottom row
Query ResultQuery Result
No query executed yet...
some-alt