PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

SQL · Theory

avg()

← All stacks

Theory

120/439

avg()

If you can teach avg() using average per subject, you know it. If you only know the heading, you don’t.

Do avg() once by hand. GROUP BY subject. Change one input. Say the new result out loud.

Without avg(), a report gets messy and average per subject is hard to trust.

avg() shows up in a report. Name average per subject, not “a real-world scenario”.

Don’t do this with avg() — SELECT extra column not in GROUP BY. Interviewers spot it in ten seconds.

Place avg() next to nearby SQL work — GROUP BY subject is the link.

One breath for avg(), then average per subject, then SELECT extra column not in GROUP BY. Sit down.

Exam tip

Say avg() in one breath, then GROUP BY subject, then SELECT extra column not in GROUP BY.

avg() — sample query

CREATE TABLE scores (id INTEGER PRIMARY KEY, marks INTEGER);
INSERT INTO scores VALUES (1, 80), (2, 90), (3, 70);
SELECT COUNT(*) AS n, AVG(marks) AS avg_marks, MAX(marks) AS top
FROM scores;

avg() — aggregate functions collapse many rows into one summary row.

Short notes

  • Defavg() — Zara uses it for average per subject in a report.
  • Ruleavg() → GROUP BY subject.
  • Rememberavg() + the query planner (a report).
  • Useavg() in a report (average per subject).
  • Trapavg() — SELECT extra column not in GROUP BY.
  • Exavg() → average per subject.

Questions

1

What is avg()? Teach it with average per subject.

2

If you skip avg(), what breaks in a report?

3

How do you catch SELECT extra column not in GROUP BY?

4

Write the smallest avg() step on average per subject. What happens?

Previous← sum()Nextmin() →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.