SQL Revision and Single-row Functions Class 12 PYQs 2024–2026 with Solutions | CBSE Informatics Practices Skip to content
Smart Notes for Every Exam · instant PDF download after payment +91 92520 37565
Class 12 · Informatics Practices · Chapter 5

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.

Cover of Class 12 Informatics Practices PYQ Book: Solved Board Papers 2024-2026 (CBSE)
Class 12 Informatics Practices PYQ book: every chapter + 3 board papers, all solved
₹99₹14934% off
Free sample

SQL Revision and Single-row Functions: board weightage

Board weightage 2024–2026

Year202420252026
Questions91010
Marks152123

Most asked topics

Text functions11
Math functions6
DDL and DML5
Date functions5
SQL revision2

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

Q1 · CBSE 2026 · 90 · Q91 mark

SELECT LENGTH('Data Base'); (A) 7 (B) 8 (C) 9 (D) Error

Solution

(C) 9: the space counts.

Q2 · CBSE 2026 · 90 · Q111 mark

Expanded form of DML:

Solution

(D) Data Manipulation Language.

Q3 · CBSE 2026 · 90 · Q171 mark

True/False: INSTR(string1, string2) returns 0 if string2 is not present in string1.

Solution

True.

Q4 · CBSE 2026 · 90 · Q191 mark

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.

Q5 · CBSE 2025 · 90 · Q21 mark

SELECT MONTHNAME('2024-08-02'); (A) 08 (B) 02 (C) February (D) August

Solution

(D) August.

Q6 · CBSE 2025 · 90 · Q81 mark

True/False: MOD() returns the quotient of division between two numbers.

Solution

False: MOD returns the remainder.

Q7 · CBSE 2025 · 90 · Q111 mark

Function that calculates ab: (A) MOD() (B) POWER() (C) RAISE() (D) ROUND()

Solution

(B) POWER().

Q8 · CBSE 2025 · 90 · Q161 mark

Match: (i) Math (ii) Aggregate (iii) Date (iv) Text with (a) COUNT() (b) ROUND() (c) RIGHT() (d) YEAR().

Full step-by-step solution is in the PYQ book (₹99).
Q9 · CBSE 2025 · 90 · Q211 mark

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.

Full step-by-step solution is in the PYQ book (₹99).
Q10 · CBSE 2024 · 90 · Q41 mark

SELECT POWER(2,MOD(17,3)); (i) 8 (ii) 1 (iii) 0 (iv) 4

Full step-by-step solution is in the PYQ book (₹99).
Q11 · CBSE 2024 · 90 · Q81 mark

MySQL command to add a primary key to an existing table: (i) UPDATE (ii) INSERT INTO (iii) ALTER TABLE (iv) ORDER BY

Full step-by-step solution is in the PYQ book (₹99).
Q12 · CBSE 2024 · 90 · Q91 mark

SELECT SUBSTR("G20 2023 INDIA", 5, 4); (i) G20 2 (ii) 2023 (iii) INDI (iv) 023

Full step-by-step solution is in the PYQ book (₹99).
Q13 · CBSE 2024 · 90 · Q111 mark

Which cannot work with SELECT? (i) FROM (ii) INSERT INTO (iii) WHERE (iv) GROUP BY

Full step-by-step solution is in the PYQ book (₹99).
Q14 · CBSE 2024 · 90 · Q141 mark

String function to extract a substring from a starting position and length: (i) SUBSTRING_INDEX() (ii) LENGTH() (iii) MID() (iv) TRIM()

Full step-by-step solution is in the PYQ book (₹99).

2 marks: very short answer

Q15 · CBSE 2026 · 90 · Q242 marks

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.

Q16 · CBSE 2026 · 90 · Q262 marks

(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

Q17 · CBSE 2025 · 90 · Q242 marks

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

Q18 · CBSE 2025 · 90 · Q262 marks

What is a DBMS? Two examples.

Full step-by-step solution is in the PYQ book (₹99).
Q19 · CBSE 2024 · 90 · Q212 marks

Output: (i) SELECT RIGHT("CHANDRAYAN3",4); (ii) SELECT ROUND(76345.456,2);

Full step-by-step solution is in the PYQ book (₹99).
Q20 · CBSE 2024 · 90 · Q252 marks

Two differences between UPDATE and ALTER TABLE.

Full step-by-step solution is in the PYQ book (₹99).

3 marks: short answer

Q21 · CBSE 2026 · 90 · Q313 marks

(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';

Q22 · CBSE 2026 · 90 · Q32(B)3 marks

(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);

Q23 · CBSE 2025 · 90 · Q313 marks

(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;

Q24 · CBSE 2024 · 90 · Q263 marks

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;

Full step-by-step solution is in the PYQ book (₹99).
Q25 · CBSE 2024 · 90 · Q283 marks

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.

Full step-by-step solution is in the PYQ book (₹99).

4 marks: SQL / case-based

Q26 · CBSE 2026 · 90 · Q344 marks

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.

Q27 · CBSE 2025 · 90 · Q34(B)4 marks

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

Q28 · CBSE 2026 · 90 · Q37(A)(I)5 marks

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.)

Q29 · CBSE 2025 · 90 · Q37(A)(ii)5 marks

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)
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();
(Aggregate parts (i), (iv) are in Chapter 6.)

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
See real pages (free sample)

Revising the chapter first? Complete Informatics Practices Notes for Class 12 (CBSE 065, 2026-27) →

What you get in the pack

All chapters in this pack

  1. PYQ Ch 1 Pandas Series
  2. PYQ Ch 2 DataFrame: Creation and Attributes
  3. PYQ Ch 3 DataFrame Operations and CSV Files
  4. PYQ Ch 4 Data Visualisation with Matplotlib
  5. PYQ Ch 5 SQL Revision and Single-row Functions
  6. PYQ Ch 6 SQL Aggregates, Grouping and Joins
  7. PYQ Ch 7 Computer Networks
  8. PYQ Ch 8 Introduction to the Internet and Web
  9. PYQ Ch 9 Societal Impacts
  10. Board Paper 2026 Set 90 with Solutions
  11. Board Paper 2025 Set 90 with Solutions
  12. Board Paper 2024 Set 90 with Solutions
← PYQ Ch 4 Data Visualisation with Matplotlib PYQ Ch 6 SQL Aggregates, Grouping and Joins →

Prices shown in Indian rupees. Show prices in: ₹ INR · US$ USD