5.17. SQL Select Functions

5.17.1. Sum

SELECT SUM(experience)
FROM astronauts
WHERE agency = 'NASA';

5.17.2. Average

SELECT AVG(age)
FROM astronauts
WHERE agency = 'NASA';

5.17.3. Count

SELECT COUNT(id)
FROM astronauts
WHERE agency = 'NASA';
SELECT COUNT(DISTINCT agency)
FROM astronauts;
SELECT COUNT(DISTINCT mission_name)
FROM astronauts
WHERE agency = 'NASA';