Regardless of the flavour, SQL databases come with many useful aggregate functions that can come in handy and save many lines of code in your queries. One of these functions is the
COUNT() function. Here's how to use it...
The query below gets you the number of all the rows in the
SELECT COUNT(*) FROM Employees
SELECT COUNT(DISTINCT employee_id) FROM Employees
SELECT salary_range, COUNT(*) FROM Employees GROUP BY salary_range
GROUP BY and
SELECT employment_rank, salary_range, COUNT(*) FROM Employees GROUP BY salary_range ORDER BY employment_rank DESC