CBSESetWise.in

Class 12 Informatics Practices: Database Query using SQL PYQs (2022–2026)

Authentic CBSE board questions & official stepwise marking scheme solutions for Database Query using SQL (Chapter 3).

Database Query using SQL

Single-row math, string, and date functions, aggregate functions, GROUP BY, HAVING, and operations on relations.

Key Topics: Math Functions (POWER, ROUND, MOD), String Functions (LENGTH, INSTR, SUBSTR, MID), Date Functions (NOW, DATE, DAYNAME), Aggregate Functions (COUNT, SUM, AVG, MAX, MIN), GROUP BY and HAVING clauses

Download Chapter Booklet PDF (26 Pages)

Database Query using SQL Previous Year Questions & Solutions (52 Questions)

Q6 • CBSE 2026 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q6 (1 Mark) State whether the following statement is True or False : In SQL, an aggregate function returns multiple values for each column on which it is applied. 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q6
Official CBSE Marking Scheme Solution

False (1 Mark for writing the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q6 Official Solution
Q8 • CBSE 2026 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q8 (1 Mark) Aditya is working on a DataFrame named df. He has written the statement : print(df.loc['S2']) What will the above statement do ? (A) Display the data of the row having label 'S2'. (B) Display the columns of the DataFrame. (C) Display the data type of the column having label 'S2'. (D) Display the index numbers of the DataFrame. 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q8
Official CBSE Marking Scheme Solution

(A) Display the data of the row having label 'S2'. (1 Mark for writing the correct option)

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q8 Official Solution
Q14 • CBSE 2026 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q14 (1 Mark) In the context of creating a Pandas Series from a dictionary, which of the following statement is correct ? (A) The values of the dictionary become the indices of the Series. (B) The keys of the dictionary become the values of the Series. (C) The keys of the dictionary become the indices of the Series. (D) The Series will have default integer indices starting from 0, ignoring the diction keys. 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q14
Official CBSE Marking Scheme Solution

(C) The keys of the dictionary become the indices of the Series (1 Mark for writing the correct option)

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q14 Official Solution
Q15 • CBSE 2026 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q15 (1 Mark) [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2026 Page: 6/22 ] In Pandas, when extracting a portion of a Series ser1 using ser1[start:end] with 1 positional indices start and end, which of the following statements is true ? (A) The element at the end index is included in the output. (B) The element at the end index is excluded from the output. (C) The elements at both the start and end indices are excluded from the output. (D) The element at the start index is excluded from the output.

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q15
Official CBSE Marking Scheme Solution

(B) The element at the end index is excluded from the output. (1 Mark for the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q15 Official Solution
Q17 • CBSE 2026 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q17 (1 Mark) State whether the following statement is True or False : The INSTR(string1, string2) function in SQL returns 0 if string2 is not present as a substring in string1. 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q17
Official CBSE Marking Scheme Solution

True (1 Mark for the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 1 Mark PYQ Q17 Official Solution
Q21 • CBSE 2026 • 2 Marks • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q21 (2 Marks) Assertion (A) : The output of the SQL query SELECT COUNT (name) FROM students; will differ from the output of SELECT COUNT (*) FROM students; if there are some NULL values in the name column. Reason (R) : COUNT (column_name) returns the count of NON NULL values in that column, whereas COUNT(*) returns the number of records in the table. 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 2 Mark PYQ Q21
Official CBSE Marking Scheme Solution

(A) Both (A) and (R) are True, and (R) correctly explains (A). (1 Mark for writing the correct option) SECTION - B

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 2 Mark PYQ Q21 Official Solution
Q22 • CBSE 2026 • 2 Marks • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q22 (2 Marks) (a) List any two characteristics of Pandas library in Python. 2

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 2 Mark PYQ Q22
Official CBSE Marking Scheme Solution

[ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2026 Page: 8/22 ] (a) Characteristics of Pandas library in Python: Tabular data structure : Works with data in the form of DataFrames (tables) and Series Easy data handling: Allows quick reading, writing, and modification of data Powerful data analysis :Supports filtering, sorting, grouping, and calculations Handles missing data :Can easily detect and fill/remove missing values Fast and efficient :Works well even with large datasets Supports multiple file formats :Can read/write multiple file formats like CSV, Excel. (1 Mark each for writing any two correct characteristics) OR (b) Briefly explain the purpose of Boolean Indexing with respect to DataFrames. Support your answer with a suitable example. (b) Boolean Indexing is used to filter and extract specific rows from a DataFrame based on given condition(s). It returns only those rows where the condition is True. Example: import pandas as pd data = {'Name': ['Ajay', 'Riya', 'David', 'Peter'], 'Age': [25, 30, 35, 40],'Score': [85, 90, 95, 80]} df = pd.DataFrame(data) condition = df['Age'] > 30 result = df[condition] print(result) Output Name Age Score 2 David 35 95 3 Peter 40 80 (1 Mark for explaining the purpose of Boolean Indexing and 1 Mark for writing any correct example) Note: Full 2 marks if indexing is explained only using example with correct condition (with or without output).

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 2 Mark PYQ Q22 Official Solution
Q26 • CBSE 2026 • 3 Marks • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q26 (3 Marks) Write SQL queries to perform the following : (I) Display the month (in numeric form) of the date '2026-01-01'. (II) Display only the year part from the date '2026-01-01'. 2

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 3 Mark PYQ Q26
Official CBSE Marking Scheme Solution

(I) SELECT MONTH('2026-01-01'); (II) SELECT YEAR('2026-01-01'); (I) (½ mark for writing SELECT, ½ mark for MONTH('2026-01-01')) (II) (½ mark for writing SELECT, ½ mark for YEAR('2026-01-01'))

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 3 Mark PYQ Q26 Official Solution
Q30 • CBSE 2026 • 3 Marks • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q30 (3 Marks) [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2026 Page: 11/22 ] (a) Write a Python program to create and display a Pandas Series as shown below : July 31 Aug 31 Sept 30 Oct 31 The index labels are the names of the months - July, Aug, Sept, Oct. 3 The corresponding scalar values are the number of days in these respective months - 31, 31, 30, 31.

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 3 Mark PYQ Q30
Official CBSE Marking Scheme Solution

import pandas as pd months = ['July', 'Aug', 'Sept', 'Oct'] days = [31, 31, 30, 31] s = pd.Series(days, index=months) OR s = pd.Series(days, months) print(s) OR import pandas as pd days = pd.Series(data=[31, 31, 30, 31], index=['July', 'Aug', 'Sept', 'Oct'] ) print(days) OR import pandas as pd days = pd.Series({'July':31, 'Aug':31, 'Sept':30, 'Oct':31}) print(days) (½ Mark for correct import statement) (½ Mark for creating index of months) (½ Mark for creating corresponding values of days) (1 Mark for pd.Series( ) ) (½ Mark for correct print statement) OR (b) A CSV file named customer.csv contains records of customers. The first row of the file represents the header. Sample data from the file is shown below : Name, Age, City Rudra,17,Kolkata Divya,19,Dehradun Nabeel,22,Lucknow Write a Python program to import data from the CSV file into a Pandas DataFrame named DF and display the last two rows. 3 (b) import pandas as pd DF = pd.read_csv("customer.csv") print(DF.tail(2)) (1 Mark for each correct statement) Note: ignore Path of csv file if mentioned by the student

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 3 Mark PYQ Q30 Official Solution
Q31 • CBSE 2026 • 5 Marks • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q31 (5 Marks) (i) Write an SQL statement to create a table named PRODUCTS with the following specifications : Column Name Data Type Key PID Integer Primary Key PName Varchar of size 30 PCat Char of size 15 Price Decimal Number 3

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 5 Mark PYQ Q31
Official CBSE Marking Scheme Solution

[ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2026 Page: 12/22 ] CREATE TABLE PRODUCTS ( PID INT PRIMARY KEY, PName VARCHAR(30), PCAT CHAR(15), PRICE FLOAT ); (½ Mark for CREATE TABLE PRODUCTS) (½ Mark for correct attributes and datatypes) (½ Mark for Primary Key) (ii) Write an SQL query to increase the price of all the items by 100, whose product category is Grocery, in the table PRODUCTS. UPDATE PRODUCTS SET PRICE=PRICE+100 WHERE PCAT='Grocery'; (½ Mark for writing UPDATE PRODUCTS) (½ Mark for SET PRICE=PRICE+100) (½ Mark for WHERE PCAT='Grocery')

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 5 Mark PYQ Q31 Official Solution
Q32 • CBSE 2026 • 5 Marks • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q32 (5 Marks) (a) Consider the following tables : Table 1 : TEACHER, which stores Teacher ID (TID), Teacher Name (TName), Experience (Experience) and City (City) that they live in. TID TName Experience City 1 Kartik 5 Bhopal 2 Shahnaz 6 Nagpur 3 Rajendra 7 Delhi 4 Tanvi 4 Bhopal 5 Alam 9 Delhi Table 2 : SUBJECT, which stores Subject ID (SID), Subject Name (SubName) and ID of the teacher(TID) teaching that Subject. SID SubName TID 101 Physics 1 102 Chemistry 2 103 Mathematics 3 104 Informatics Practices 4 105 Computer Science 5 Write appropriate SQL query for the following: 3 (I) Delete the record of the subject whose TID is equal to 4.

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 5 Mark PYQ Q32
Official CBSE Marking Scheme Solution

[ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2026 Page: 13/22 ] (I) DELETE FROM SUBJECT WHERE TID = 4; (½ Mark for DELETE FROM SUBJECT) (½ Mark for WHERE TID=4) (II) Display the names of teachers who have more than 5 years of experience and who stay in Nagpur. (II) SELECT TNAME FROM TEACHER WHERE EXPERIENCE>5 AND CITY = 'Nagpur'; [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2026 Page: 14/22 ] (½ Mark for SELECT TNAME FROM TEACHER) (½ Mark for WHERE EXPERIENCE>5 AND CITY='Nagpur') (III) Display subject names along with their teacher names. (III) SELECT SUBNAME, TNAME FROM SUBJECT NATURAL JOIN TEACHER; OR SELECT SUBNAME, TNAME FROM SUBJECT, TEACHER WHERE SUBJECT.TID = TEACHER.TID; OR SELECT SUBNAME, TNAME FROM SUBJECT S, TEACHER T WHERE S.TID = T.TID; OR SELECT SUBNAME, TNAME FROM SUBJECT S JOIN TEACHER T ON S.TID = T.TID; (½ Mark SELECT SUBNAME, TNAME FROM SUBJECT, TEACHER) (½ Mark NATURAL JOIN TEACHER OR WHERE SUBJECT.TID=TEACHER.TID) OR (b) Consider the table LIBRARY as given below. 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) Which attribute(s) can be considered as the Candidate keys(s)? Justify your answer. (I) BookId BookId is unique to every row of table. NOTE: BookId and Title to be accepted with correct justification (½ Mark for writing correct attribute) (½ Mark for Justification) (II) Write an SQL query to insert a new record with the following values: BookId : 501 Title : AI for ALL Genre : Technology Price : 589 (II) INSERT INTO LIBRARY VALUES (501, 'AI for ALL', 'Technology', 589); OR INSERT INTO LIBRARY (BookId, Title, Genre, Price) VALUES (501, 'AI for ALL', 'Technology', 589); (½ Mark for INSERT INTO LIBRARY) (½ Mark for VALUES((501, 'AI for ALL', 'Technology', 589);) (III) Write an SQL query to add a new column Author that is a character data type of size 20. (III) ALTER TABLE LIBRARY ADD COLUMN AUTHOR VARCHAR(20); OR ALTER TABLE LIBRARY ADD AUTHOR VARCHAR(20) ; OR ALTER TABLE LIBRARY ADD COLUMN AUTHOR CHAR(20) ; OR ALTER TABLE LIBRARY ADD AUTHOR CHAR(20) ; (½ Mark for ALTER TABLE LIBRARY) (½ Mark for ADD AUTHOR VARCHAR(20)/CHAR(20)) SECTION - D

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 5 Mark PYQ Q32 Official Solution
Q37 • CBSE 2026 • 5 Marks • Database Query using SQL (Chapter 3)

CBSE 2026 Board Examination (Set 4) — Question Q37 (5 Marks) (a) Write suitable SQL query for the following : 5 I. To display only the date part from the date/time expression '2026-01-01 10:10:10'

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 5 Mark PYQ Q37
Official CBSE Marking Scheme Solution

[ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2026 Page: 21/22 ] SELECT DATE('2026-01-01 10:10:10'); (½ Mark for SELECT) (½ Mark for DATE () with datetime string) II. To convert all customer names from the Cust_Name column to lowercase in the Customer table. SELECT LOWER(Cust_Name) FROM Customer; OR SELECT LCASE(Cust_Name) FROM Customer; (½ Mark for SELECT) (½ Mark for LOWER ()/LCASE()) III. To extract the first 4 characters from the City_Name column in Location table. SELECT LEFT(City_Name,4) FROM Location; OR SELECT SUBSTR(City_Name,1,4)FROM Location; OR SELECT MID(City_Name,1,4)FROM Location; ( ½ Mark for SELECT ) ( ½ Mark for correct SQL function LEFT() or SUBSTR()) IV. To display the name of the city from the CITY column in EVENT table, after removing leading spaces. SELECT LTRIM(CITY) FROM EVENT; ( ½ Mark for SELECT ) ( ½ Mark for correct SQL function LTRIM()) V. To find the average salary from Salary column in Employees table. SELECT AVG(Salary) FROM Employees; OR SELECT SUM(Salary)/COUNT(Salary) FROM Employees; ( ½ Mark for SELECT ) ( ½ Mark for correct SQL function AVG() OR SUM()/COUNT()) OR (b) Write suitable SQL query for the following : I. To display the value of 172 . SELECT POW(17,2); OR SELECT POWER(17, 2); ( ½ Mark for SELECT ) ( ½ Mark for correct SQL function POW()/ POWER()) II. To display the day part of the dates in the Hire_Date column of the Employee table. SELECT DAY(Hire_Date)FROM Employee; ( ½ Mark for SELECT ) ( ½ Mark for correct SQL function DAY()) Note : DAYOFMONTH() also to be accepted III. To display the maximum value of the Bill_Amount column in the Bill table. SELECT MAX(Bill_Amount) FROM Bill; ( ½ Mark for SELECT ) ( ½ Mark for correct SQL function MAX()) IV. To remove leading and trailing spaces from the Location column in the Branch table. UPDATE Branch SET Location = TRIM(Location); OR SELECT TRIM(Location) FROM Branch; ( ½ Mark for UPDATE/SELECT ) ( ½ Mark for correct SQL function TRIM()) V. To display total salary from tot_sal column in Employees table. SELECT SUM(tot_sal) FROM Employees; ( ½ Mark for SELECT ) ( ½ Mark for correct SQL function SUM()) Note: SELECT tot_sal FROM Employees; to be accepted ( ½ Mark for SELECT ) ( ½ Mark for correct column)

CBSE Class 12 Database Query using SQL (Chapter 3) 2026 5 Mark PYQ Q37 Official Solution
Q4 • CBSE 2025 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q4 (1 Mark) Which of the following is not an aggregate function in SQL? (A) COUNT(*) (B) MIN() (C) LEFT() (D) AVG() 1 [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2025 Page: 3/24 ]

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q4
Official CBSE Marking Scheme Solution

(C) LEFT() (1 Mark for writing the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q4 Official Solution
Q8 • CBSE 2025 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q8 (1 Mark) State whether the following statement is True or False : The MOD() function in SQL returns the quotient of division operation between two numbers. 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q8
Official CBSE Marking Scheme Solution

False (1 Mark for writing the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q8 Official Solution
Q11 • CBSE 2025 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q11 (1 Mark) Which SQL function calculates ab ? (A) MOD() (B) POWER() (C) RAISE() (D) ROUND() 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q11
Official CBSE Marking Scheme Solution

(B) POWER() (1 Mark for writing the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q11 Official Solution
Q13 • CBSE 2025 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q13 (1 Mark) Which of the following Python statements will be used to select a specific element having index as points, from a Pandas Series named ser ? (A)​ser.element(points) (B)​ser.select(points) (C)​ser[points] (D)​ser.show(points) 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q13
Official CBSE Marking Scheme Solution

(C) ser[points] (1 Mark for writing the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q13 Official Solution
Q16 • CBSE 2025 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q16 (1 Mark) With respect to SQL, match the function given in column-II with categories given 1 [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2025 Page: 5/24 ] in column-I: I II (i) Math function (a) COUNT() (ii) Aggregate function (b) ROUND() (iii) Date function (c) RIGHT() (iv) Text function (d) YEAR() Options : (A)​(i)-(c), (ii)-(d), (iii)-(a), (iv)-(b) (B)​(i)-(b), (ii)-(a), (iii)-(d), (iv)-(c) (C)​(i)-(d), (ii)-(b), (iii)-(a), (iv)-(c) (D)​(i)-(b), (ii)-(c), (iii)-(d), (iv)-(a)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q16
Official CBSE Marking Scheme Solution

(B)​(i)-(b), (ii)-(a), (iii)-(d), (iv)-(c) (1 Mark for writing the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q16 Official Solution
Q17 • CBSE 2025 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q17 (1 Mark) Which of the following Python statements is used to change a column label in a DataFrame, df ?​ (A)​df = df.rename({old_name : new_name}, axis='columns') (B)​df = df.rename(old_name, new_name), axis='columns' (C)​df = df.change_name(old_name, new_name, axis='bar') (D)​df = df.update({old_name : new_name}, axis='bar') 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q17
Official CBSE Marking Scheme Solution

(A)​df = df.rename({old_name : new_name}, axis='columns') (1 Mark for writing the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 1 Mark PYQ Q17 Official Solution
Q21 • CBSE 2025 • 2 Marks • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q21 (2 Marks) Assertion (A) : The ROUND() function in SQL can be used to round off a number to a specified number of decimal places.​ Reason (R) : The ROUND() function is a string function that accepts character values as input and returns numerical values as output. 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 2 Mark PYQ Q21
Official CBSE Marking Scheme Solution

(C) - Assertion (A) is TRUE and Reason (R) is FALSE (1 Mark for writing the correct answer) SECTION B

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 2 Mark PYQ Q21 Official Solution
Q22 • CBSE 2025 • 2 Marks • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q22 (2 Marks) (a)​Mention any two main points of difference between Series and DataFrame of Python Pandas. 2

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 2 Mark PYQ Q22
Official CBSE Marking Scheme Solution

Series DataFrame Series is one-dimensional DataFrame is two-dimensional Series is used for storing a single column of data. DataFrame is used for storing multiple columns of data. Elements in Series must be homogeneous Elements in DataFrame may be heterogeneous. Elements in Series are accessed using a single index. Elements in DataFrame are accessed using two indices. Size of Series is immutable Size of DataFrame is mutable (1 Mark each for writing any two correct differences) Note: Full 2 marks to be awarded if difference is explained using examples of each. 1 mark to be awarded if only examples of both are written. OR (b)​Explain how we can access elements of a series using slicing. Give an example to support your answer. Elements of a series can be accessed in any of the following ways using slicing: Example: [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2025 Page: 7/24 ] Considering data to be a pandas series containing values [10, 20, 30, 40, 50] having index as ['a','b','c','d','e'] Positional Indexing/ Integer-based slicing: Slice a Series using indices # Slice the Series from the first to the third element data[0:3] OR data.iloc[0:3] Label-based slicing: Slice a Series using its index labels. data['b':'d'] OR data.loc['b':'d'] Conditional slicing: Slice a Series based on condition. # Slice the Series where values are greater than 30 #for a pandas series named as data data[data > 30] (1 Mark for explaining any one method of slicing) (1 Mark for correct example) Note: Full 2 marks to be awarded if accessing using slicing is explained with the help of an example. (1 mark to be awarded if only example is written)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 2 Mark PYQ Q22 Official Solution
Q24 • CBSE 2025 • 2 Marks • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q24 (2 Marks) Consider the string, "Informatics Practices". Write suitable SQL queries for the following : 2 (i)​ To convert the entire string to uppercase.

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 2 Mark PYQ Q24
Official CBSE Marking Scheme Solution

SELECT UCASE("Informatics Practices"); OR SELECT UPPER("Informatics Practices"); (ii)​ To display the total number of characters in the given string. SELECT LEN("Informatics Practices"); OR SELECT LENGTH("Informatics Practices"); (1 Mark each for both the parts (i) and (ii)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 2 Mark PYQ Q24 Official Solution
Q28 • CBSE 2025 • 3 Marks • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q28 (3 Marks) (a)​Rohit is trying to create a Pandas Series from scalar values. His code has some mistakes. Rewrite the correct code and underline the corrections made.​ ​ ​ import pandas ​ ​ data = [50, 15, 40] ​ ​ series = pd.series(data, Index=['x', 'y', 'z']) ​ ​ Print(series) 2

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 3 Mark PYQ Q28
Official CBSE Marking Scheme Solution

import pandas as pd data=[50,15,40] #OR data = <any numeric value> series=pd.Series(data, index=['x', 'y', 'z']) print(series) (½ Mark each for identifying and correcting any 4 Errors) Note: Only 1 Mark to be awarded for identification (without correction) of all four mistakes OR (b)​ Complete the given Python code to generate the following output :​ COLOUR NAME QTY 0 Red Apple 10 1 Blue Berry 15 2 Green Guava 20 ​ import _________ as pd ​ data=[{'COLOUR':'Red', 'NAME':'Apple', 'QTY':10}, [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2025 Page: 10/24 ] ​ {'COLOUR':'Blue','NAME':'Berry', 'QTY':15}, ​ {___________, 'NAME' :'Guava','QTY':20}] ​ df=pd.DataFrame(__________) ​ print(____________) import pandas as pd data= [{'COLOUR':'Red' , 'NAME': 'Apple' , 'QTY' : 10}, {'COLOUR':'Blue' , 'NAME': 'Berry' , 'QTY' : 15}, {'COLOUR':'Green' , 'NAME': 'Guava' , 'QTY' : 20}] df=pd.DataFrame(data) print(df) (½ Mark each for writing each correct missing part of the given code) SECTION C

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 3 Mark PYQ Q28 Official Solution
Q31 • CBSE 2025 • 5 Marks • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q31 (5 Marks) (i)​ Write the SQL statement to create a table, Customer with the following specifications :​ Table:Customer Column Name Data Type Key CID Int Primary Key FName Varchar(20) LName Varchar(20) Age Int (2+1) 3

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 5 Mark PYQ Q31
Official CBSE Marking Scheme Solution

CREATE TABLE Customer ( CID INT PRIMARY KEY, FName VARCHAR(20), LName VARCHAR(20), Age INT ); OR [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2025 Page: 13/24 ] CREATE TABLE Customer ( CID INT , FName VARCHAR(20), LName VARCHAR(20), Age INT , PRIMARY KEY (CID) ); OR CREATE TABLE Customer ( CID INT , FName VARCHAR(20), LName VARCHAR(20), Age INT , CONSTRAINT PK_CID PRIMARY KEY (CID) ); (½ mark for writing correct CREATE TABLE) (1 mark for writing correct Field names & Datatype) (½ mark for writing correct Primary Key constraint) (ii)​ Write the SQL query to display all records in descending order of LName from the Table Customer. SELECT * FROM Customer ORDER BY LName DESC; (½ mark for writing SELECT * FROM Customer) (½ mark for writing ORDER BY LName DESC)

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 5 Mark PYQ Q31 Official Solution
Q32 • CBSE 2025 • 5 Marks • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q32 (5 Marks) (a)​Given the following tables: ​ Table: 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 ​ Table: GRADES S_ID SUBJECT GRADE 1 Math A 2 English B 3 Math C 4 English A 5 Math B Write SQL queries for the following: 3 (i)​ To display the number of students from each city.

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 5 Mark PYQ Q32
Official CBSE Marking Scheme Solution

SELECT CITY, COUNT(*) FROM STUDENTS GROUP BY CITY; Note: [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2025 Page: 14/24 ] ●​ SELECT COUNT(*) AS <COLUMN ALIAS NAME> FROM STUDENTS GROUP BY CITY; also to be accepted ●​ SELECT COUNT(*) FROM STUDENTS​GROUP BY CITY; also to be accepted (½ mark for writing SELECT CITY, COUNT(*)FROM STUDENTS) (½ mark for writing GROUP BY CITY) (ii)​ To find the average age of all students. SELECT AVG(AGE) FROM STUDENTS; (½ mark for writing SELECT AVG(AGE)) (½ mark for writing FROM STUDENTS) (iii)​ To list the names of students and their grades. SELECT NAME, GRADE FROM STUDENTS S, GRADES G WHERE S.S_ID = G.S_ID ; OR SELECT NAME, GRADE FROM STUDENTS, GRADES WHERE STUDENTS.S_ID = GRADES.S_ID ; OR SELECT NAME, GRADE FROM STUDENTS NATURAL JOIN GRADES ; (½ mark for writing SELECT NAME, GRADE FROM STUDENTS, GRADES) (½ mark for writing correct part to join the tables) OR (b)​Consider the following tables: Table 1: PRODUCTS ​ This table stores the basic details of the products available in a shop. PID PName Category 201 Laptop Electronics 202 Chair Furniture 203 Desk Furniture 204 Smartphone NULL 205 Tablet Electronics ​ Table 2: SALES This table records the number of units sold for each product. SaleID PID UnitsSold 301 201 50 302 202 100 303 203 60 304 204 80 [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2025 Page: 15/24 ] 305 205 70 Write SQL queries for the following: (i) To delete those records from table SALES whose UnitsSold is less than 80. DELETE FROM SALES WHERE UnitsSold < 80; (½ mark for writing DELETE FROM SALES) (½ mark for writing WHERE UnitsSold < 80) (ii) To display the names of all products whose category is not known. SELECT PName FROM PRODUCTS WHERE Category IS NULL; (½ mark for writing SELECT PName FROM PRODUCTS) (½ mark for writing WHERE Category IS NULL) (iii) To display the product names along with their corresponding units sold. SELECT PName, UnitsSold FROM PRODUCTS P, SALES S WHERE P.PID = S.P_ID ; OR SELECT PName, UnitsSold FROM PRODUCTS, SALES WHERE PRODUCTS.PID = SALES.PID ; OR SELECT PName, UnitsSold FROM PRODUCTS NATURAL JOIN SALES; (½ mark for writing SELECT PName, UnitsSold) (½ mark for writing correct part to join the tables) SECTION D

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 5 Mark PYQ Q32 Official Solution
Q37 • CBSE 2025 • 5 Marks • Database Query using SQL (Chapter 3)

CBSE 2025 Board Examination (Set 4) — Question Q37 (5 Marks) (a) Write SQL query for the following: 5 (i) To display sum total of all the values of the Score column, from STUDENTS table.

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 5 Mark PYQ Q37
Official CBSE Marking Scheme Solution

SELECT SUM(Score) FROM STUDENTS; (½ mark for writing SELECT SUM(Score)) (½ mark for writing FROM STUDENTS) (ii) To display the first five characters of the Name column from STUDENTS table. SELECT LEFT(Name,5) FROM STUDENTS; OR SELECT MID(Name,1,5) FROM STUDENTS; OR SELECT SUBSTRING(Name,1,5) FROM STUDENTS; OR SELECT SUBSTR(Name,1,5) FROM STUDENTS; (½ mark for writing SELECT part) (½ mark for writing FROM STUDENTS) (iii) To display the values of Name column from the STUDENTS table, after removing the trailing spaces. SELECT RTRIM(Name) FROM STUDENTS; (½ mark for writing SELECT RTRIM(Name)) (½ mark for writing FROM STUDENTS) (iv) To retrieve the lowest score from the Score column of GRADES table. SELECT MIN(Score) FROM GRADES; (½ mark for writing SELECT MIN(Score)) (½ mark for writing FROM GRADES) (v) To increase the fee of all students by 100, in the STUDENTS table. (The name of the column is FEE) UPDATE STUDENTS SET FEE = FEE + 100; (½ mark for writing UPDATE STUDENTS) (½ mark for writing SET FEE = FEE + 100) OR (b) Write SQL queries for the following: (i) To calculate the square of 15. SELECT POWER(15, 2); OR SELECT POW(15, 2); (½ mark for writing SELECT part) (½ mark for writing POWER(15,2) OR POW(15,2)) (ii) To round the number 456.789 to the nearest integer. SELECT ROUND(456.789); (½ mark for writing SELECT part) (½ mark for writing ROUND(456.789)) [ CBSE MS Informatics Practices Subject Code 065 Paper Code 90 Class 12 Main 2025 Page: 23/24 ] (iii) To display the position of first occurrence of 'com' in the string 'mycommercial.com'. SELECT INSTR('mycommercial.com','com'); (½ mark for writing SELECT INSTR) (½ mark for writing ('mycommercial.com','com')) (iv) To display the name of the day for the date '2024-11-07'. SELECT DAYNAME ('2024-11-07'); (½ mark for writing SELECT) (½ mark for writing DAYNAME ('2024-11-07')) (v) To display the current date and time. SELECT NOW(); OR SELECT SYSDATE(); (½ mark for writing SELECT) (½ mark for writing NOW()/ SYSDATE())

CBSE Class 12 Database Query using SQL (Chapter 3) 2025 5 Mark PYQ Q37 Official Solution
Q3 • CBSE 2024 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q3 (1 Mark) What can an individual do to enhance the privacy of data stored digitally ? 1 (i) Share sensitive information on social media platforms. (ii) Use your date of birth as your password. (iii) Regularly update software installed on your device. (iv) Download and install software from unknown sources.

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q3
Official CBSE Marking Scheme Solution

(iii) Regularly update software installed on your device (1 Mark for the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q3 Official Solution
Q4 • CBSE 2024 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q4 (1 Mark) What will be the output of the following query ? SELECT POWER(2,MOD(17,3)); 1 (i) 8 (ii) 1 (iii) 0 (iv) 4

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q4
Official CBSE Marking Scheme Solution

(iv) 4 (1 Mark for the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q4 Official Solution
Q5 • CBSE 2024 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q5 (1 Mark) Which of the following is not an aggregate function in MYSQL ? 1 (i) AVG() (ii) MAX() (iii) LCASE() (iv) MIN()

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q5
Official CBSE Marking Scheme Solution

(iii) LCASE() (1 Mark for the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q5 Official Solution
Q9 • CBSE 2024 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q9 (1 Mark) What will be the output of the following query ? SELECT SUBSTR("G20 2023 INDIA", 5, 4); 1 (i) G20 2 (ii) 2023 (iii) INDI (iv) 023

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q9
Official CBSE Marking Scheme Solution

(ii) 2023 (1 Mark for the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q9 Official Solution
Q11 • CBSE 2024 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q11 (1 Mark) Which of the following clause cannot work with SELECT statement in MYSQL ? 1 (i) FROM (ii) INSERT INTO (iii) WHERE (iv) GROUP BY

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q11
Official CBSE Marking Scheme Solution

(ii) INSERT INTO (1 Mark for the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q11 Official Solution
Q14 • CBSE 2024 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q14 (1 Mark) Page 5/23 Which MySQL string function is used to extract a substring from a given string based on a specified starting position and length ? 1 (i) SUBSTRING_INDEX() (ii) LENGTH() (iii) MID() (iv) TRIM() CBSE AISSCE 2024 Marking Scheme for Informatics Practices (Sub Code: 065 Paper Code 90) SET-4

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q14
Official CBSE Marking Scheme Solution

(iii) MID() (1 Mark for the correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 1 Mark PYQ Q14 Official Solution
Q21 • CBSE 2024 • 2 Marks • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q21 (2 Marks) What will be the output of the following SQL queries : 2 (i) SELECT RIGHT ("CHANDRAYAN3",4); (ii) SELECT ROUND(76345.456,2);

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 2 Mark PYQ Q21
Official CBSE Marking Scheme Solution

(i) YAN3 (ii) 76345.46 (1 Mark each for writing each correct output)

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 2 Mark PYQ Q21 Official Solution
Q26 • CBSE 2024 • 3 Marks • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q26 (3 Marks) (a) Consider the given table and write the following queries in MySQL : Table: Sports 3 (i) To display Sid and name of those sports which are to be played in the month of September. 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

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 3 Mark PYQ Q26
Official CBSE Marking Scheme Solution

Page 9/23 SELECT Sid, SName FROM Sports WHERE Monthname(DateofPlay)= "September"; OR SELECT Sid, SName FROM Sports WHERE Month(DateofPlay)= 9; CBSE AISSCE 2024 Marking Scheme for Informatics Practices (Sub Code: 065 Paper Code 90) SET-4 Page 10/23 OR SELECT Sid, SName FROM Sports WHERE Month(DateofPlay)= '9'; OR SELECT Sid, SName FROM Sports WHERE DateofPlay LIKE "%-09-%"; OR SELECT Sid, SName FROM Sports WHERE DateofPlay>='2024-09-01' AND DateofPlay<='2024-09-30'; OR SELECT Sid, SName FROM Sports WHERE DateofPlay BETWEEN '2024-09-01' AND '2024-09-30'; (½ Mark for writing the correct SELECT part) (½ Mark for writing the correct WHERE part) (ii) To display all Sports names in lower case. SELECT LCASE(SName) FROM Sports; OR SELECT LOWER(SName) FROM Sports; (½ Mark for writing SELECT part) (½ Mark for writing FROM Sports) (iii) To display last two characters of all sports names whose fees is less than 1500. SELECT RIGHT(SName, 2) FROM Sports WHERE Fees<1500; OR SELECT MID(SName,LENGTH(SName)-1,2) FROM Sports WHERE Fees<1500; OR SELECT SUBSTR(SName,-2) FROM Sports WHERE Fees<1500; OR SELECT SUBSTR(SName,LENGTH(SName)-1,2) FROM Sports WHERE Fees<1500; OR SELECT SUBSTRING(SName,LENGTH(SName)-1,2) FROM Sports WHERE Fees<1500; (½ Mark for writing correct SELECT part) (½ Mark for writing correct WHERE part) (b) OR Predict the output of the following queries based on the table Sports given above : (i) SELECT UCASE(TRIM(SName)) FROM Sports WHERE Sid=5 ; (i) BADMINTON (1 Mark for writing the correct output) Note: ½ mark to be awarded if the output is not in uppercase (ii) SELECT LEFT (SName,3) FROM Sports WHERE DateofPlay>"2024-09-13"; CBSE AISSCE 2024 Marking Scheme for Informatics Practices (Sub Code: 065 Paper Code 90) SET-4 (ii) Law Bad (½ Mark each for writing correct line of the output) (iii) SELECT SUBSTR (CoachId,1) FROM Sports WHERE SName="Cricket" or Fees>=2000; S3 S4 (½ Mark each for writing correct line of the output)

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 3 Mark PYQ Q26 Official Solution
Q30 • CBSE 2024 • 3 Marks • Database Query using SQL (Chapter 3)

CBSE 2024 Board Examination (Set 4) — Question Q30 (3 Marks) Consider the given DataFrame 'password': CodeName Category Frequency 0 aaaaaa alpha 6.91 1 dragon animal 18.52 2 baseball sport 1.29 3 football sport 11.11 4 monkey animal 3.72 5 qwerty alpha 1.85 6 abcde alpha 3.19 Write suitable Python statements for the following : 3 (i) To add a new row with following values : CodeName - 'abc123' Category - alphanumeric Frequency - 12.8

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 3 Mark PYQ Q30
Official CBSE Marking Scheme Solution

Page 14/23 (i) password.loc[7]=['abc123','alphanumeric',12.8] OR password.at[7]=['abc123','alphanumeric',12.8] OR password.loc[len(password)] = ['abc123','alphanumeric',12.8] OR password.at[len(password)] = ['abc123','alphanumeric',12.8] OR password.loc[len(password.index)] = ['abc123','alphanumeric',12.8] OR password.at[len(password.index)] = ['abc123','alphanumeric',12.8] OR password.loc[7,:]=['abc123','alphanumeric',12.8] OR password.at[7,:]=['abc123','alphanumeric',12.8] OR password=password.append({"CodeName":"abc123","Category":"alpha numeric","Frequency":12.8}, ignore_index=True) CBSE AISSCE 2024 Marking Scheme for Informatics Practices (Sub Code: 065 Paper Code 90) SET-4 OR df1=pd.DataFrame({"CodeName":["abc123"],"Category":["alphanumer ic"],"Frequency":[12.8]}) OR password=pd.concat([password,df1], ignore_index=True) (1 Mark for writing any correct Python statement) (ii) To delete the row with the row label 2. (ii) password.drop(2, inplace=True) OR password.drop(2, inplace=True, axis=0) OR password.drop(labels=2, inplace=True) OR password.drop(labels=2, axis=0, inplace=True) OR password.drop([2], inplace=True) OR password.drop([2], axis=0, inplace=True) OR password=password.drop([2]) OR password=password.drop([2], axis=0) OR password.drop([password.index[2]], inplace=True) OR password.drop(password.index[2:3], inplace=True) (1 Mark for writing any correct Python statement) (iii) To delete the column having column label as Frequency. (iii) password.drop("Frequency", axis=1, inplace=True) OR password.drop(columns=['Frequency'], inplace=True) OR password.drop(password.columns[2], axis=1, inplace=True) OR password.drop(password.iloc[:, 2:], inplace=True, axis=1) OR password.drop(password.loc[:, "Frequency":].columns, inplace=True, axis=1) (1 Mark for writing any correct Python statement) SECTION-D

CBSE Class 12 Database Query using SQL (Chapter 3) 2024 3 Mark PYQ Q30 Official Solution
Q5 • CBSE 2023 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q5 (1 Mark) Aggregate functions are also known as: (i) Scalar Functions (ii) Single Row Functions (iii) Multiple Row Functions (iv) Hybrid Functions 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q5
Official CBSE Marking Scheme Solution

Ans (iii) Multiple Row Functions (1 Mark for correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q5 Official Solution
Q7 • CBSE 2023 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q7 (1 Mark) Ravisha has stored the records of all students of her class in a MYSQL table. Suggest a suitable SQL clause that she should use to display the names of students in alphabetical order. (i) SORT BY (ii) ALIGN BY (iii) GROUP BY (iv) ORDER BY 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q7
Official CBSE Marking Scheme Solution

Ans (iv) ORDER BY (1 Mark for correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q7 Official Solution
Q8 • CBSE 2023 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q8 (1 Mark) To remove the leading and trailing space from data values in a column of MySql Table, we use (i) Left( ) (ii) Right( ) (iii) Trim( ) (iv) Ltrim( ) 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q8
Official CBSE Marking Scheme Solution

Ans (iii) Trim ( ) (1 Mark for correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q8 Official Solution
Q9 • CBSE 2023 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q9 (1 Mark) If the substring is not present in a string, the INSTR() returns: (i) – 1 (ii) 1 (iii) NULL (iv) 0 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q9
Official CBSE Marking Scheme Solution

Ans (iv) 0 (1 Mark for correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q9 Official Solution
Q14 • CBSE 2023 • 1 Mark • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q14 (1 Mark) Which of the following is not a valid aggregate function in MYSQL ? (i) COUNT( ) (ii) SUM( ) (iii) MAX( ) (iv) LEN( ) 1

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q14
Official CBSE Marking Scheme Solution

Ans (iv) LEN ( ) (1 Mark for correct answer)

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 1 Mark PYQ Q14 Official Solution
Q20 • CBSE 2023 • 2 Marks • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q20 (2 Marks) Keshav has written the following query to find out the sum of bonus earned by the employees of WEST zone : SELECT zone, TOTAL (bonus) FROM employee HAVING zone = 'WEST'; But he got an error. Identify the errors and rewrite the query by underlining the correction(s) done. 2

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 2 Mark PYQ Q20
Official CBSE Marking Scheme Solution

Ans SELECT zone, SUM(bonus) FROM employee WHERE Zone = 'WEST'; OR SELECT SUM(bonus) FROM employee WHERE Zone = 'WEST'; OR SELECT zone, SUM(bonus) FROM employee GROUP BY zone HAVING Zone = 'WEST' ; (1 Mark each for both the corrections) Note: No marks to be deducted if correct query is written but underlining is not done

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 2 Mark PYQ Q20 Official Solution
Q21 • CBSE 2023 • 2 Marks • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q21 (2 Marks) Differentiate between COUNT( ) and COUNT(*) functions in MYSQL. Give suitable examples to support your answer. 2

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 2 Mark PYQ Q21
Official CBSE Marking Scheme Solution

Ans COUNT(Column_Name) COUNT(*) It returns the number of non-null values in the column used in COUNT() It returns the number of rows in the table Example: SALES SCode SName Commission S001 Amit 2500 S002 Jones S003 Ahmed 2600 - 7 of 20- CBSE AISSCE 2023 Marking Scheme for Informatics Practices ies ⅀HEFG (Sub Code: 065 Paper Code 90) SET-4 SELECT COUNT(Commission) FROM Sales; will return 2 SELECT COUNT(*) FROM Sales; will return 3 (1 Mark for stating correct difference) (1 Mark for writing any one example explaining the difference) NOTE: ● Full 2 marks to be awarded if the difference is explained with the help of an example. ● 1 mark to be awarded if COUNT() is mentioned as an error.

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 2 Mark PYQ Q21 Official Solution
Q31 • CBSE 2023 • 5 Marks • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q31 (5 Marks) Write the SQL queries which will perform the following operations: 5 (i) To display the year from your Date of Admission which is '2023-05-15'.

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 5 Mark PYQ Q31
Official CBSE Marking Scheme Solution

Ans SELECT YEAR('2023-05-15'); OR SELECT YEAR(DOA) FROM XYZ; (Any column name for Date of admission and any table name to be accepted) (½ Mark for SELECT) (½ Mark for correct use of YEAR) (ii) To convert your email id 'ABC@XYZ.com' to lowercase. - 13 of 20- CBSE AISSCE 2023 Marking Scheme for Informatics Practices ies ⅀HEFG (Sub Code: 065 Paper Code 90) SET-4 Ans SELECT LOWER('ABC@XYZ.com'); OR SELECT LCASE('ABC@XYZ.com'); (½ Mark for SELECT) (½ Mark for correct use of LOWER/LCASE) (iii) To remove leading spaces from a string ‘ my country’. Ans SELECT LTRIM(' my country'); OR SELECT TRIM(' my country'); (½ Mark for SELECT) (½ Mark for correct use of LTRIM/TRIM) (iv) To display current date. Ans SELECT CURDATE(); OR SELECT SYSDATE(); OR SELECT CURRENT_DATE(); OR SELECT CURRENT_TIMESTAMP() OR SELECT NOW(); OR SELECT DATE(NOW()); OR SELECT LOCALTIME(); OR SELECT LOCALTIMESTAMP(); (½ Mark for SELECT) (½ Mark for correct use of any of the above mentioned DATE functions) (v) To display the value of 106 Ans SELECT POWER(10,6); OR SELECT POW(10,6) (½ Mark for SELECT) (½ Mark for correct use of POWER/POW function) OR Consider a table PRODUCT with the following data: Table: PRODUCT SNO Itemname Company Stockdate Price Discount 1 Monitor HP 2021-12-20 15499.739 15 2 Webcam Logitech 2020-02-03 4890.90 5 3 Keyboard Logitech 2022-08-19 1878.985 30 4 Mouse HCL 2021-05-16 1200.00 7 5 Speakers iBall 2021-10-19 NULL 25 Write SQL queries using SQL functions to perform the following operations : 5 (i) Display the first 3 characters of all Itemnames. Ans SELECT LEFT(ITEMNAME,3) FROM PRODUCT; OR SELECT MID(ITEMNAME,1,3) FROM PRODUCT; OR SELECT SUBSTR(ITEMNAME,1,3) FROM PRODUCT; OR SELECT SUBSTRING(ITEMNAME,1,3) FROM PRODUCT; - 14 of 20- CBSE AISSCE 2023 Marking Scheme for Informatics Practices ies ⅀HEFG (Sub Code: 065 Paper Code 90) SET-4 (½ Mark for SELECT .. FROM PRODUCT) (½ Mark for correct use of LEFT/MID/SUBSTR/SUBSTRING function) (ii) Display the names of all items whose Stockday is "Monday" Ans SELECT ITEMNAME FROM PRODUCT WHERE DAYNAME(STOCKDATE)='MONDAY'; OR SELECT ITEMNAME FROM PRODUCT WHERE DAYOFWEEK(STOCKDATE)=2; (½ Mark for SELECT ITEMNAME FROM PRODUCT) (½ Mark for correct use of WHERE condition) Note: 1. Full 1 Mark to be awarded, if “Stockday” is considered as a column name. SELECT ITEMNAME FROM PRODUCT WHERE STOCKDAY='MONDAY'; 2. Full 1 Mark to be awarded, if "No column with the name Stockday" is mentioned. (iii) Display the total price of all the products. Ans SELECT SUM(PRICE) FROM PRODUCT; (½ Mark for SELECT .. FROM PRODUCT) (½ Mark for correct use of SUM function) (iv) Display the maximum Price. Ans SELECT MAX(PRICE) FROM PRODUCT; (½ Mark for SELECT .. FROM PRODUCT) (½ Mark for correct use of MAX function) (v) Display the average Price of all the products by the company named 'Logitech' Ans SELECT AVG(PRICE) FROM PRODUCT WHERE COMPANY='Logitech'; (½ Mark for SELECT AVG(PRICE)FROM PRODUCT) (½ Mark for correct use of WHERE with appropriate condition)

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 5 Mark PYQ Q31 Official Solution
Q34 • CBSE 2023 • 4 Marks • Database Query using SQL (Chapter 3)

CBSE 2023 Board Examination (Set 4) — Question Q34 (4 Marks) Consider the following table Schooldata : Table: Schooldata Admno Name Grade Club Marks Gender 20150001 Sargam Singh 12 STEM 86 Male 20140212 Alok Kumar 10 SPACE 75 Male 20090234 Mohit Gaur 11 SPACE 84 Male 20130216 Romil Malik 10 READER 91 Male 20190227 Tanvi Batra 11 STEM 70 Female 20120200 Nomita Ranjan 12 STEM 64 Female Write SQL queries for the following: 1+1+ 2 i) Display the average Marks secured by each Gender.

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 4 Mark PYQ Q34
Official CBSE Marking Scheme Solution

Ans SELECT Gender, AVG(marks) FROM Schooldata GROUP BY Gender; (½ mark for SELECT..FROM) (½ mark for GROUP BY) ii) Display the minimum Marks secured by the students of Grade 10. Ans SELECT MIN(Marks) FROM Schooldata WHERE Class=10; OR SELECT MIN(Marks) FROM Schooldata WHERE Class='10'; (½ mark for using SELECT MIN(MARKS) FROM Schooldata) (½ mark for correct use of WHERE condition) iii) Display the total number of students in each Club where number of students are more than 1. Ans SELECT Club, COUNT(*) FROM Schooldata GROUP BY Club HAVING COUNT(*)>1; (½ mark for SELECT) (½ mark for COUNT(*)) (½ mark for GROUP BY) (½ mark for correct use of HAVING condition) OR (Option for Part (iii) only) iii) Display the maximum and minimum marks secured by each gender. 2 Ans SELECT MAX(Marks),MIN(Marks), Gender FROM Schooldata GROUP BY Gender; (½ mark for SELECT) (½ mark for MAX()) (½ mark for MIN()) (½ mark for GROUP BY)

CBSE Class 12 Database Query using SQL (Chapter 3) 2023 4 Mark PYQ Q34 Official Solution
Q3 • CBSE 2022 • 2 Marks • Database Query using SQL (Chapter 3)

3. Find the output of the following SQL Queries : (i) SELECT ROUND (7658.345, 2); (ii) SELECT MOD (ROUND (13.9, 0), 3); OR Give any two differences between the POWER( ) and SUM( ) SQL functions.

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 2 Mark PYQ Q3
Official CBSE Marking Scheme Solution

(i) 7658.35 (ii) 2 (since ROUND(13.9, 0) = 14, and 14 MOD 3 = 2). OR 1. POWER() is a single-row mathematical function, while SUM() is a multiple-row (aggregate) group function. 2. POWER(m, n) takes two numeric arguments, whereas SUM(col) takes a single column name argument.

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 2 Mark PYQ Q3 Official Solution
Q5 • CBSE 2022 • 2 Marks • Database Query using SQL (Chapter 3)

5. Find the output of the following SQL queries : (i) SELECT SUBSTR ("FIT INDIA MOVEMENT", 5); (ii) SELECT INSTR ("ARTIFICIAL INTELLIGENCE", "IA");

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 2 Mark PYQ Q5
Official CBSE Marking Scheme Solution

(i) INDIA MOVEMENT (Extracts substring starting from 5th position to the end). (ii) 8 (Index of first occurrence of 'IA' in 'ARTIFICIAL INTELLIGENCE' is 8).

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 2 Mark PYQ Q5 Official Solution
Q6 • CBSE 2022 • 2 Marks • Database Query using SQL (Chapter 3)

6. Srikanth created table STUDENT (RollNo, Name, Class, Marks). He executed: SELECT MAX (Marks) FROM STUDENT WHERE COUNT (*) > 3 GROUP BY Class; But got an error. Identify the error(s) and rewrite the query.

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 2 Mark PYQ Q6
Official CBSE Marking Scheme Solution

Errors: Aggregate condition COUNT(*) > 3 cannot be used with WHERE clause; it must be placed in HAVING clause after GROUP BY. Also, to display class-wise count, Class and COUNT(*) should be selected. Corrected Query: SELECT Class, COUNT(*) FROM STUDENT GROUP BY Class HAVING COUNT(*) > 3;

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 2 Mark PYQ Q6 Official Solution
Q7 • CBSE 2022 • 2 Marks • Database Query using SQL (Chapter 3)

7. Consider table SCHOOLDATA (Admno, Name, Class, House, Percent, Gender, Dob). Write SQL statements to: (i) Remove leading spaces from the column Name. (ii) Display the names of students who were born on Sunday. OR Predict the output of: (i) SELECT MAX(Percent) FROM SCHOOLDATA; (ii) SELECT LEFT(Gender, 1), Name FROM SCHOOLDATA WHERE YEAR(Dob) = 2005;

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 2 Mark PYQ Q7
Official CBSE Marking Scheme Solution

(i) SELECT LTRIM(Name) FROM SCHOOLDATA; (ii) SELECT Name FROM SCHOOLDATA WHERE DAYNAME(Dob) = 'Sunday'; OR (i) 91 (ii) F Swapnil Pant M Rahil Arora

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 2 Mark PYQ Q7 Official Solution
Q8 • CBSE 2022 • 3 Marks • Database Query using SQL (Chapter 3)

8. Predict the output of the following SQL queries : (i) SELECT TRIM (" ALL THE BEST "); (ii) SELECT POWER(5, 2); (iii) SELECT UPPER (MID ("start up india", 10)); OR Consider table MYPET (Pet_id, Pet_Name, Breed, LifeSpan, Price, Discount). Write SQL queries to: (i) Display Breed of all pets in uppercase. (ii) Display total price of all pets. (iii) Display average life span of all pets.

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 3 Mark PYQ Q8
Official CBSE Marking Scheme Solution

(i) ALL THE BEST (ii) 25 (iii) INDIA OR (i) SELECT UPPER(Breed) FROM MYPET; (ii) SELECT SUM(Price) FROM MYPET; (iii) SELECT AVG(LifeSpan) FROM MYPET;

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 3 Mark PYQ Q8 Official Solution
Q9 • CBSE 2022 • 3 Marks • Database Query using SQL (Chapter 3)

9. Write the names of SQL functions to perform the following operations : (i) Display name of the Month from your date of birth. (ii) Convert email-id to lowercase. (iii) Count the number of characters in your name.

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 3 Mark PYQ Q9
Official CBSE Marking Scheme Solution

(i) MONTHNAME() (ii) LOWER() or LCASE() (iii) LENGTH()

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 3 Mark PYQ Q9 Official Solution
Q10 • CBSE 2022 • 3 Marks • Database Query using SQL (Chapter 3)

10. Consider table PRODUCT (PID, PNAME, PRICE, QUANTITY). Find output of: (i) SELECT 10 + MOD(QUANTITY, 3) FROM PRODUCT WHERE PNAME = 'Eraser'; (ii) SELECT ROUND(PRICE, 2) * QUANTITY FROM PRODUCT WHERE QUANTITY > 2; (iii) SELECT UCASE(RIGHT(PNAME, 2)) FROM PRODUCT;

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 3 Mark PYQ Q10
Official CBSE Marking Scheme Solution

(i) 12 (10 + MOD(5, 3) = 10 + 2 = 12) (ii) 52.50 75.30 (iii) ER EN EN ER

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 3 Mark PYQ Q10 Official Solution
Q11 • CBSE 2022 • 4 Marks • Database Query using SQL (Chapter 3)

11. Consider table ITEM (SNo, Itemname, Type, Price, Stockdate). Write SQL queries to: (i) Display all records in descending order of Stockdate. (ii) Display the type and total number of items of each Type. (iii) Display the least Price. (iv) Display Itemname with price rounded to 1 decimal place.

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 4 Mark PYQ Q11
Official CBSE Marking Scheme Solution

(i) SELECT * FROM ITEM ORDER BY Stockdate DESC; (ii) SELECT Type, COUNT(*) FROM ITEM GROUP BY Type; (iii) SELECT MIN(Price) FROM ITEM; (iv) SELECT Itemname, ROUND(Price, 1) FROM ITEM;

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 4 Mark PYQ Q11 Official Solution
Q12 • CBSE 2022 • 4 Marks • Database Query using SQL (Chapter 3)

12. Consider table SALESMAN (Scode, Sname, Area, Qtysold, Dateofjoin). Predict the output for: (i) SELECT MAX(Qtysold), MIN(Qtysold) FROM SALESMAN; (ii) SELECT COUNT(Area) FROM SALESMAN; (iii) SELECT LENGTH(Sname) FROM SALESMAN WHERE MONTH(Dateofjoin) = 10; (iv) SELECT Sname FROM SALESMAN WHERE RIGHT(Scode, 1) = 5; OR Write SQL queries for: (i) Total salesmen, (ii) Max qtysold by area, (iii) Average qtysold by area with >1 salesmen, (iv) Ascending order of area.

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 4 Mark PYQ Q12
Official CBSE Marking Scheme Solution

(i) 280 68 (ii) 5 (Excludes NULL in Area) (iii) 4 5 (iv) Ankit OR (i) SELECT COUNT(*) FROM SALESMAN; (ii) SELECT Area, MAX(Qtysold) FROM SALESMAN GROUP BY Area; (iii) SELECT Area, AVG(Qtysold) FROM SALESMAN GROUP BY Area HAVING COUNT(*) > 1; (iv) SELECT * FROM SALESMAN ORDER BY Area;

CBSE Class 12 Database Query using SQL (Chapter 3) 2022 4 Mark PYQ Q12 Official Solution

Other Informatics Practices Chapters

Data Handling using Pandas • Data Visualization with Matplotlib • Database Query using SQL • Introduction to Computer Networks • Societal Impacts