Skip to content · ⁨דלג לתוכן⁩

Counting and averaging · ⁨ספירה וממוצע⁩

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

עברית

סיכום עם פונקציות אגרגט

לעיתים לא רוצים את השורות עצמן, אלא סיכום שלהן. פונקציות אגרגט ממירנות שורות רבות לערך אחד:

  • COUNT(*) — כמה שורות
  • SUM(col) — הסך הכל
  • AVG(col) — הממוצע
  • MIN(col) / MAX(col) — הקטן ביותר / הגדול ביותר
SELECT COUNT(*) FROM student;

COUNT, SUM ו-AVG מצמצמות עמודה שלמה למספר אחד כל אחת

Handout · ⁨חומר עזר⁩

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP