SQL Aggregates, Grouping and Joins: Class 12 PYQs 2024–2026 with solutions
All 12 CBSE board questions asked from SQL Aggregates, Grouping and Joins in 3 board papers, with the year, set and marks of each. 8 are solved free below. The Class 12 Informatics Practices PYQ Book: Solved Board Papers 2024-2026 (CBSE) has every solution, all chapters and 3 full board papers.
SQL Aggregates, Grouping and Joins: board weightage
Board weightage 2024–2026
| Year | 2024 | 2025 | 2026 |
|---|---|---|---|
| Questions | 3 | 5 | 4 |
| Marks | 10 | 13 | 8 |
Most asked topics
12 questions from 3 papers. Repeated questions are shown once with every year they were asked.
Jump to: 1 mark2 marks3 marks4 marks5 marks
1 mark: MCQ and Assertion–Reason
True/False: In SQL, an aggregate function returns multiple values for each column on which it is applied.
Solution
False: it returns a single value for a group of rows.
A–R. (A): SELECT COUNT(name) FROM students; will differ from SELECT COUNT(*) FROM students; if there are NULL values in name. (R): COUNT(column_name) counts non-NULL values in that column, whereas COUNT(*) returns the number of records.
Solution
(A) Both true and R correctly explains A.
Which is not an aggregate function in SQL? (A) COUNT(*) (B) MIN() (C) LEFT() (D) AVG()
Which is not an aggregate function in MySQL? (i) AVG() (ii) MAX() (iii) LCASE() (iv) MIN()
2 marks: very short answer
37(a)(i) Sum of all values of Score from STUDENTS; (iv) lowest Score from GRADES.
Solution
SELECT SUM(Score) FROM STUDENTS; SELECT MIN(Score) FROM GRADES;
3 marks: short answer
TEACHER (TID, TName, Experience, City): 1 Kartik 5 Bhopal; 2 Shahnaz 6 Nagpur; 3 Rajendra 7 Delhi; 4 Tanvi 4 Bhopal; 5 Alam 9 Delhi. SUBJECT (SID, SubName, TID): 101 Physics 1; 102 Chemistry 2; 103 Mathematics 3; 104 Informatics Practices 4; 105 Computer Science 5. (I) Delete the subject whose TID is 4. (II) Names of teachers with more than 5 years' experience who stay in Nagpur. (III) Subject names with their teacher names.
Solution
DELETE FROM SUBJECT WHERE TID = 4;(III) Physics Kartik, Chemistry Shahnaz, Mathematics Rajendra, (Informatics Practices Tanvi, if (I) not run), Computer Science Alam.
SELECT TName FROM TEACHER
WHERE Experience > 5 AND City = 'Nagpur'; -- Shahnaz
SELECT SubName, TName FROM SUBJECT NATURAL JOIN TEACHER;
-- or FROM SUBJECT S, TEACHER T WHERE S.TID = T.TID
-- or FROM SUBJECT S JOIN TEACHER T ON S.TID = T.TID
37 (a) V. Average salary from Employees; (b) III. maximum Bill_Amount from Bill; V. total salary from tot_sal of Employees.
Solution
SELECT AVG(Salary) FROM Employees; -- or SUM(Salary)/COUNT(Salary)
SELECT MAX(Bill_Amount) FROM Bill;
SELECT SUM(tot_sal) FROM Employees;
STUDENTS (S_ID, NAME, AGE, CITY): 1 Rahul 20 Delhi; 2 Priya 22 Mumbai; 3 David 21 Delhi; 4 Neha 23 Bengaluru; 5 Khurshid 22 Delhi. GRADES (S_ID, SUBJECT, GRADE): 1 Math A; 2 English B; 3 Math C; 4 English A; 5 Math B. (i) Number of students from each city; (ii) average age of all students; (iii) names of students and their grades.
OR: PRODUCTS (PID, PName, Category): 201 Laptop Electronics; 202 Chair Furniture; 203 Desk Furniture; 204 Smartphone NULL; 205 Tablet Electronics. SALES (SaleID, PID, UnitsSold): 301 201 50; 302 202 100; 303 203 60; 304 204 80; 305 205 70. (i) Delete records from SALES with UnitsSold < 80; (ii) names of products whose category is not known; (iii) product names with units sold.
4 marks: SQL / case-based
COURSE (C_ID, C_NAME, INSTRUCTOR, DURATION): C101 Data Structures Dr. Alok 40; C102 Machine Learning Prof. Sunita 60; C103 Web Development Ms. Sakshi 45; C104 Database Management Mr. Suresh 45; C105 Python Programming Dr. Pawan 35. (i) Add record C106, Introduction to AI, Ms. Preeti, 55; (ii) longest duration; (iii) total number of courses; (iv) instructors' names in lower case.
Solution
INSERT INTO COURSE VALUES ('C106', 'Introduction to AI', 'Ms. Preeti', 55);
SELECT MAX(DURATION) FROM COURSE; -- 60
SELECT COUNT(*) FROM COURSE; -- or COUNT(DISTINCT C_NAME)
SELECT LOWER(INSTRUCTOR) FROM COURSE;Table NOBEL (Winner_id, YEAR, SUBJECT, WINNER, COUNTRY, CATEGORY). Queries: (i) names of winners in Literature for 1970; (ii) subject and category of winners whose country is not known; (iii) details of winners who were Scientists; (iv) count winners whose subject is Literature.
Solution
SELECT WINNER FROM NOBEL WHERE SUBJECT = 'Literature' AND YEAR = 1970;Note
SELECT SUBJECT, CATEGORY FROM NOBEL WHERE COUNTRY IS NULL;
SELECT * FROM NOBEL WHERE CATEGORY = 'Scientist';
SELECT COUNT(*) FROM NOBEL WHERE SUBJECT = 'Literature';
IS NULL, never = NULL.5 marks: programs and case studies
Employee (Employee_id, First_name, Last_name, Salary, Joining_date, Department): E101 Monika Das 100000 2019-01-20 Finance; E102 Mehek Verma 600000 2019-01-15 IT; E103 Manan Pant 890000 2019-02-05 Banking; E104 Shivam Agarwal 200000 2019-02-25 Insurance; E105 Alisha Singh 220000 2019-02-28 Finance; E106 Poonam Sharma 400000 2019-05-10 IT; E107 Anshuman Mishra 123000 2019-06-20 Banking. Reward (Employee_id, Date_reward, Amount): E101 2019-05-11 1000; E102 2019-02-15 5000; E103 2019-04-22 2000; E106 2019-06-20 8000.
(i) Change Shivam's department to IT. (ii) Remove Alisha's record. (iii) Add column Experience (integer). (iv) First name, last name and reward amount for all employees. (v) First name and salary of employees whose amount is less than 2000.
OR OR: (i) Year of joining of all employees. (ii) Each department and its average salary. (iii) First name and date of reward of employees who joined on Monday. (iv) Sum of salary of employees whose reward amount > 3000. (v) Remove the table Reward. 5
Solution
UPDATE Employee SET Department = 'IT' WHERE First_name = 'Shivam';(iv) Monika Das 1000, Mehek Verma 5000, Manan Pant 2000, Poonam Sharma 8000. (v) Monika 100000. NATURAL JOIN is also accepted.
DELETE FROM Employee WHERE First_name = 'Alisha';
ALTER TABLE Employee ADD Experience INT;
SELECT First_name, Last_name, Amount
FROM Employee E, Reward R WHERE E.Employee_id = R.Employee_id;
SELECT First_name, Salary FROM Employee E, Reward R
WHERE E.Employee_id = R.Employee_id AND Amount < 2000;
OR
SELECT YEAR(Joining_date) FROM Employee;
SELECT Department, AVG(Salary) FROM Employee GROUP BY Department;
SELECT First_name, Date_reward FROM Employee E, Reward R
WHERE E.Employee_id = R.Employee_id
AND DAYNAME(Joining_date) = 'Monday';
SELECT SUM(Salary) FROM Employee E, Reward R
WHERE E.Employee_id = R.Employee_id AND Amount > 3000;
DROP TABLE Reward;
(ii) Banking 506500, Finance 160000, Insurance 200000, IT 500000. (iii) Only Shivam joined on a Monday (2019-02-25) and he has no reward row, so the query returns no rows. (iv) Mehek 600000 + Poonam 400000 = 1000000.
Get every solution for all chapters
- Every board question of every chapter, each fully solved the way the board gives marks
- 3 complete board papers, each followed by its solutions
- Weightage and most-asked topics for every chapter
- Instant PDF download, colour and black & white print copies
Revising the chapter first? Complete Informatics Practices Notes for Class 12 (CBSE 065, 2026-27) →
What you get in the pack
- CBSE Class 12 Informatics Practices board papers 2024 to 2026 (3 full board papers)
- All 9 chapters and 3 board papers complete
- Part A: all 9 chapters, questions sorted chapter-wise and by marks
- Year-wise weightage table and most-asked topics for every chapter
- Part B: each full board paper followed by its complete solutions
- Pandas, Matplotlib and SQL answers verified by running the code
- Only the current syllabus in Part A
All chapters in this pack
- PYQ Ch 1 Pandas Series
- PYQ Ch 2 DataFrame: Creation and Attributes
- PYQ Ch 3 DataFrame Operations and CSV Files
- PYQ Ch 4 Data Visualisation with Matplotlib
- PYQ Ch 5 SQL Revision and Single-row Functions
- PYQ Ch 6 SQL Aggregates, Grouping and Joins
- PYQ Ch 7 Computer Networks
- PYQ Ch 8 Introduction to the Internet and Web
- PYQ Ch 9 Societal Impacts
- Board Paper 2026 Set 90 with Solutions
- Board Paper 2025 Set 90 with Solutions
- Board Paper 2024 Set 90 with Solutions
