Calculating Summary Statistics

Statistics reduce a dataset to information users can interpret.

SELECT
  COUNT(*) AS result_count,
  COUNT(DISTINCT team_name) AS team_count,
  SUM(wins) AS total_wins,
  AVG(wins) AS average_wins,
  MAX(wins) AS highest_wins
FROM team_results;

Choose statistics because they answer a need, not because functions are available. Label values clearly and round averages deliberately.

<p>Average wins:
  <?= number_format((float) $stats["average_wins"], 1) ?>
</p>

Interpretation

A number without context is weak. State what population and timeframe it represents. Do not imply cause from a descriptive statistic.

Check


Revision #1
Created 2026-08-18 23:36:33 UTC by Mr Napper
Updated 2026-08-18 23:36:36 UTC by Mr Napper