8.13. SQL Select Functions

8.13.1. Sum

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

8.13.2. Average

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

8.13.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';