Aggregate Functions
Aggregate Functions is simple if you keep it on paper. Priya uses it for average per subject in a report.
Aggregate Functions on the board — GROUP BY subject. Then say what average per subject looks like after.
Aggregate Functions exists so Priya can keep average per subject correct in a report.
Use Aggregate Functions when average per subject must stay clear. If a simpler SQL step works, use that instead.
Aggregate Functions trap — SELECT extra column not in GROUP BY. Priya loses marks for that every viva.
Place Aggregate Functions next to nearby SQL work — GROUP BY subject is the link.
Close Aggregate Functions with: “If I skip it, average per subject goes wrong like this: SELECT extra column not in GROUP BY.”
Say Aggregate Functions in one breath, then GROUP BY subject, then SELECT extra column not in GROUP BY.