So far every query brought rows as they are. Aggregate functions reduce many rows to one number: COUNT(*) the number of rows, SUM the total, AVG the average, MIN and MAX the smallest and largest.
SELECT genre, COUNT(*) AS booksFROM booksGROUP BY genre;
GROUP BY sorts the rows into heaps of those sharing a genre; the aggregate function runs separately for each heap. The result has one row per genre. AS names the result column.Without GROUP BY an aggregate function treats the whole table as one heap and returns one row: SELECT COUNT(*) FROM books is the number of books. Mind what you count: COUNT(*) counts rows, COUNT(translator) only the rows where the translator is not missing.