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,
9
1
2
3
SELECT SUM(revenue)
FROM sells
WHERE item = 'Sofa'
123SELECT SUM(revenue) FROM sells WHERE item = 'Sofa'
Please note, that
SUM
function works only with numeric columns.
Tâche
Swipe to start coding
From the audi_cars
table calculate the total tax
for all RS4 cars.
Solution
9
1
2
3
SELECT SUM(tax)
FROM audi_cars
WHERE model = 'RS4'
Tout était clair ?
Merci pour vos commentaires !
Section 3. Chapitre 2
single
9
1
No query executed yet... |
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion