6.17. SQL Select Functions

6.17.1. Sum

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

6.17.2. Average

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

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