COUNT(*) gives one count for the whole log. GROUP BY repeats that calculation for each distinct value of a column. The example counts runs with the same status. ORDER BY controls the order in which the groups appear.
SELECT status, COUNT(*) AS runs
FROM deployments
GROUP BY status
ORDER BY status;Show one row per environment with the environment first and its number of runs as deployment_count. Sort the environments alphabetically.