AI Computer Science Academy · Faisalabad

SQL & Databases

AVG, MIN, MAX

Task 12 of 56 SQL Section 2 · Summaries
All tasks
Read first Task 12

AVG, MIN, MAX

AVG is the mean; MIN and MAX give the smallest and largest.

Task

Which function gives the mean?

The editor already contains a starting point. Change it until every check passes — the Next task button unlocks when it does.

What you start with
SELECT MIN(monthly_fee), MAX(monthly_fee), AVG(monthly_fee) FROM courses;
Syntax reference
SELECT MIN(monthly_fee), MAX(monthly_fee), AVG(monthly_fee) FROM courses;

Read it, then write it yourself. Copy-paste teaches nothing.

The sample database
CREATE TABLE courses (id INTEGER PRIMARY KEY, title TEXT, monthly_fee INTEGER);
CREATE TABLE students (id INTEGER PRIMARY KEY, name TEXT, city TEXT, course_id INTEGER, joined TEXT);
CREATE TABLE fees (id INTEGER PRIMARY KEY, student_id INTEGER, month TEXT, amount INTEGER, paid INTEGER);

INSERT INTO courses VALUES (1,'Web Design',9000),(2,'Python',11667),(3,'JavaScript',11667),(4,'AI & Prompt Engineering',15000);
INSERT INTO students VALUES
 (1,'Sara','Faisalabad',2,'2026-01-12'),
 (2,'Ali','Faisalabad',1,'2026-01-20'),
 (3,'Hina','Jhumra',2,'2026-02-02'),
 (4,'Bilal','Faisalabad',4,'2026-02-15'),
 (5,'Ayesha','Sargodha',3,'2026-03-01'),
 (6,'Usman','Jhumra',1,'2026-03-11'),
 (7,'Zainab','Faisalabad',4,'2026-04-05'),
 (8,'Hamza','Faisalabad',3,'2026-04-19');
INSERT INTO fees VALUES
 (1,1,'2026-01',11667,1),(2,1,'2026-02',11667,1),
 (3,2,'2026-01',9000,1),(4,2,'2026-02',9000,0),
 (5,3,'2026-02',11667,1),(6,3,'2026-03',11667,0),
 (7,4,'2026-02',15000,1),(8,4,'2026-03',15000,1),
 (9,5,'2026-03',11667,0),
 (10,6,'2026-03',9000,1),(11,6,'2026-04',9000,0),
 (12,7,'2026-04',15000,0),
 (13,8,'2026-04',11667,1);
SQL 1 automatic check Section 2 · Summaries
Code editor Ctrl + Enter runs
Run your code to see the output and the checks.
Your result

Submit your code to see results

Write your code in the middle column and press Run code.

Checks on this task:

  • Check 1

Track progress

0 of 56 tasks complete

Next task unlocks when every check passes.

Sign in to keep your code and certificates.

Next task (pass every check first)