SQL Revision and Single-row Functions: Class 12 PYQs 2024–2026 with solutions
All 29 CBSE board questions asked from SQL Revision and Single-row Functions in 3 board papers, with the year, set and marks of each. 17 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 Revision and Single-row Functions: board weightage
Board weightage 2024–2026
| Year | 2024 | 2025 | 2026 |
|---|---|---|---|
| Questions | 9 | 10 | 10 |
| Marks | 15 | 21 | 23 |
Most asked topics
29 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
SELECT LENGTH('Data Base'); (A) 7 (B) 8 (C) 9 (D) Error
Solution
(C) 9: the space counts.
Expanded form of DML:
Solution
(D) Data Manipulation Language.
True/False: INSTR(string1, string2) returns 0 if string2 is not present in string1.
Solution
True.
SELECT ROUND(15.678, 2); (A) 15.00 (B) 15.67 (C) 15.68 (D) 16.00
Solution
(C) 15.68: the third decimal 8 ≥ 5 rounds 15.67 up.
SELECT MONTHNAME('2024-08-02'); (A) 08 (B) 02 (C) February (D) August
Solution
(D) August.
True/False: MOD() returns the quotient of division between two numbers.
Solution
False: MOD returns the remainder.
Function that calculates ab: (A) MOD() (B) POWER() (C) RAISE() (D) ROUND()
Solution
(B) POWER().
Match: (i) Math (ii) Aggregate (iii) Date (iv) Text with (a) COUNT() (b) ROUND() (c) RIGHT() (d) YEAR().
A–R. (A): ROUND() can round a number to a specified number of decimal places. (R): ROUND() is a string function that accepts character values and returns numbers.
SELECT POWER(2,MOD(17,3)); (i) 8 (ii) 1 (iii) 0 (iv) 4
MySQL command to add a primary key to an existing table: (i) UPDATE (ii) INSERT INTO (iii) ALTER TABLE (iv) ORDER BY
SELECT SUBSTR("G20 2023 INDIA", 5, 4); (i) G20 2 (ii) 2023 (iii) INDI (iv) 023
Which cannot work with SELECT? (i) FROM (ii) INSERT INTO (iii) WHERE (iv) GROUP BY
String function to extract a substring from a starting position and length: (i) SUBSTRING_INDEX() (ii) LENGTH() (iii) MID() (iv) TRIM()
2 marks: very short answer
Define (a) Domain (b) Tuple.
Solution
(a) The set of all possible values that an attribute can take. (b) A row of a table representing one complete record.
(I) Month (numeric) of '2026-01-01'. (II) Year part of '2026-01-01'.
Solution
SELECT MONTH('2026-01-01'); → 1; SELECT YEAR('2026-01-01'); → 2026
For "Informatics Practices": (i) convert to uppercase (ii) display the total number of characters.
Solution
(i) SELECT UPPER("Informatics Practices"); (ii) SELECT LENGTH("Informatics Practices"); → 21
What is a DBMS? Two examples.
Output: (i) SELECT RIGHT("CHANDRAYAN3",4); (ii) SELECT ROUND(76345.456,2);
Two differences between UPDATE and ALTER TABLE.
3 marks: short answer
(i) Create PRODUCTS (PID INT primary key, PName VARCHAR(30), PCat CHAR(15), Price decimal). (ii) Increase price by 100 for category Grocery.
Solution
CREATE TABLE PRODUCTS ( PID INT PRIMARY KEY, PName VARCHAR(30),
PCat CHAR(15), Price FLOAT );
UPDATE PRODUCTS SET Price = Price + 100 WHERE PCat = 'Grocery';
(b) LIBRARY(BookId, Title, Genre, Price): 101 Python Basics Technology 278; 201 The Silent Patient Fiction 340; 301 Data Science Technology 291; 401 Oceans Marine Life NULL. (I) Candidate key(s)? (II) Insert 501, 'AI for ALL', 'Technology', 589. (III) Add column Author CHAR/VARCHAR(20).
Solution
(I) BookId: unique for every row (Title, if unique, was also accepted). (II) INSERT INTO LIBRARY VALUES (501, 'AI for ALL', 'Technology', 589); (III) ALTER TABLE LIBRARY ADD Author VARCHAR(20);
(i) Create table Customer (CID INT primary key, FName VARCHAR(20), LName VARCHAR(20), Age INT). (ii) Display all records in descending order of LName.
Solution
CREATE TABLE Customer ( CID INT PRIMARY KEY,
FName VARCHAR(20), LName VARCHAR(20), Age INT );
SELECT * FROM Customer ORDER BY LName DESC;
Table Sports(Sid, SName, Fees, DateofPlay, CoachId): 1 Karate 1200 2024-08-24 S1; 2 Football 1800 2024-09-13 S2; 3 Cricket 1500 2024-06-14 S3; 4 Lawn Tennis 2500 2024-09-25 S4; 5 Badminton 1800 2024-10-20 S5. (a) Queries: (i) Sid and name of sports played in September; (ii) all sports names in lower case; (iii) last two characters of sports names with fees < 1500. (b) Outputs: (i) SELECT UCASE(TRIM(SName)) FROM Sports WHERE Sid=5; (ii) SELECT LEFT(SName,3) FROM Sports WHERE DateofPlay>"2024-09-13"; (iii) SELECT SUBSTR(CoachId,1) FROM Sports WHERE SName="Cricket" or Fees>=2000;
Table Salesman (salesman_id, name, city, commission): 5001 Neil Bhatt Delhi 0.15; 5002 Rohan Malik Mumbai 0.13; 5005 Ravi Mohan Delhi 0.11; 5006 Mehak Rai Delhi 0.14; 5007 Paul Lal Bangalore 0.13; 5003 Raman Sen Kolkata 0.12. (i) Number of tuples? (ii) Primary key? (iii) All records in descending order of commission.
4 marks: SQL / case-based
34(a) Guest(GuestID, GuestName, RoomNumber, CheckInDate, Charges): (I) last 3 characters of guest name in upper case; (II) name with day name of check-in; (III) remainder when charges are divided by 1000; (IV) three characters from the second character of each name.
OR 34(b) ORDERS(ORDERID, CUSTOMERNAME, TOTALAMOUNT, DISCOUNT, ORDERDATE): 101 Hemant 5000 10 2024-03-01; 102 Neha 7000 15 NULL; 103 Keshav 3000 5 2024-01-20; 104 Sandhya 4500 NULL 2023-12-25. Outputs: (I) names where DISCOUNT IS NOT NULL (II) name, discount with DISCOUNT BETWEEN 5 AND 10 (III) MONTHNAME(ORDERDATE) where not null (IV) ORDERID, DAY(ORDERDATE).
Solution
SELECT UPPER(RIGHT(GuestName, 3)) FROM Guest;
SELECT GuestName, DAYNAME(CheckInDate) FROM Guest;
SELECT MOD(Charges, 1000) FROM Guest;
SELECT SUBSTR(GuestName, 2, 3) FROM Guest; -- or MID()
OR (I) Hemant, Neha, Keshav (II) Hemant 10; Keshav 5 (III) March, January, December (IV) 101 1; 102 NULL; 103 20; 104 25.
EMPLOYEE(EID, EMP_NAME, DEPT, SALARY, JOIN_DATE): E01 ARJUN SINGH SALES 75000 2019-11-01; E02 PRIYA JAIN ENGINEERING 85000 2020-05-20; E03 RAVI SHARMA MARKETING 60000 2018-08-14; E04 AYESHA NULL 50000 2021-01-10; E05 RAHUL VERMA FINANCE 40000 2017-06-25. Outputs: (i) SUBSTRING(EMP_NAME,1,5) … WHERE DEPT='ENGINEERING' (ii) EMP_NAME … WHERE month(JOIN_DATE)=8 (iii) EMP_NAME … WHERE SALARY > 60000 (iv) count(DEPT)
Solution
(i) PRIYA (ii) RAVI SHARMA (iii) ARJUN SINGH, PRIYA JAIN (60000 is not > 60000) (iv) 4 (COUNT ignores the NULL DEPT).
5 marks: programs and case studies
37 (a) I. Date part of '2026-01-01 10:10:10'; II. names in lower case; III. first 4 characters of City_Name; IV. city after removing leading spaces. (b) I. 17²; II. day part of Hire_Date; IV. remove leading and trailing spaces from Location.
Solution
SELECT DATE('2026-01-01 10:10:10'); -- 2026-01-01
SELECT LOWER(Cust_Name) FROM Customer;
SELECT LEFT(City_Name, 4) FROM Location;
SELECT LTRIM(CITY) FROM EVENT;
SELECT POWER(17, 2); -- 289
SELECT DAY(Hire_Date) FROM Employee;
SELECT TRIM(Location) FROM Branch; -- or UPDATE … SET Location=TRIM(Location)(AVG, MAX, SUM parts: Chapter 6.)37 Queries: (a)(ii) first five characters of Name from STUDENTS; (iii) Name after removing trailing spaces; (v) increase FEE of all students by 100. (b)(i) square of 15; (ii) round 456.789 to the nearest integer; (iii) position of first 'com' in 'mycommercial.com'; (iv) day name of '2024-11-07'; (v) current date and time.
Solution
SELECT LEFT(Name, 5) FROM STUDENTS; -- or MID(Name,1,5)(Aggregate parts (i), (iv) are in Chapter 6.)
SELECT RTRIM(Name) FROM STUDENTS;
UPDATE STUDENTS SET FEE = FEE + 100;
SELECT POWER(15, 2); -- 225
SELECT ROUND(456.789); -- 457
SELECT INSTR('mycommercial.com', 'com'); -- 3
SELECT DAYNAME('2024-11-07'); -- Thursday
SELECT NOW();
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
