Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara 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.

Compito

Swipe to start coding

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

Soluzione

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

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 3. Capitolo 2

Query ResultQuery Result
No query executed yet...

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt