Skip to content · ⁨Pular para o conteúdo⁩

Counting and averaging · ⁨Contagem e média⁩

English

Summarising with aggregate functions

Sometimes you do not want the rows themselves, but a summary of them. Aggregate functions turn many rows into a single value:

  • COUNT(*) — how many rows
  • SUM(col) — the total
  • AVG(col) — the average
  • MIN(col) / MAX(col) — the smallest / largest

Português

Resumindo com funções agregadas

Às vezes você não quer as próprias linhas, mas um resumo delas. Funções agregadas convertem muitas linhas em um único valor:

  • COUNT(*) — quantas linhas
  • SUM(col) — o total
  • AVG(col) — a média
  • MIN(col) / MAX(col) — o menor / o maior
SELECT COUNT(*) FROM student;

COUNT, SUM e AVG reduzem toda uma coluna a um único número cada

Handout · ⁨Material de apoio⁩

Log in or create account · ⁨Entrar ou criar conta⁩

IGCSE, A-Level & AP