Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
🗄️ Unit 3 – Database Management (20 marks)  ·  Lesson 21

📝 Unit 3 Board Questions + Practice

What is on this page

Unit 3 of the 2026-27 syllabus carries 20 marks. Part A has 24 new practice questions with answers (click "Show answer" only after you try). Part B has all 27 questions of Unit 3 from the previous CBSE board papers (2022, 2023, 2026) in their original form – tables, code and internal choices included – each with a worked answer.

How to use for best result

1) Read the unit lessons first. 2) Solve Part A in your notebook, then check answers. 3) Attempt Part B paper-wise with a timer – about 1.5 minutes per mark. 4) Mark the questions you got wrong and revise that lesson again.

Part A – Practice questions with answers

U3-011 markImportant

A relation has 8 rows and 5 columns. State its cardinality and degree.

Show answer

Cardinality 8; degree 5.

U3-021 markImportant

A table has three candidate keys and one is selected as primary. How many alternate keys remain?

Show answer

2.

U3-031 markImportant

Which command can add an attribute to an existing table?

Show answer

ALTER TABLE … ADD (e.g. ALTER TABLE STUDENT ADD City VARCHAR(20);)

U3-041 markImportant

A table has 6 rows, with 2 NULL values in Phone. State COUNT(*) and COUNT(Phone).

Show answer

6 and 4.

U3-051 markImportant

Which clause filters grouped results: WHERE or HAVING?

Show answer

HAVING.

U3-061 markImportant

Under the default tuple-returning cursor, what Python structure does fetchall() return?

Show answer

A list of tuples.

U3-072 marksImportant

Explain candidate key and foreign key using STUDENT(SID,Name,CID) and CLASS(CID,ClassName). Assume SID and CLASS.CID uniquely identify records.

Show answer

SID is a candidate key of STUDENT; CLASS.CID is a candidate key of CLASS. STUDENT.CID can be a foreign key referencing CLASS.CID, linking students to classes.

U3-082 marks

Differentiate CHAR(10) and VARCHAR(10). State the purpose of NOT NULL and UNIQUE.

Show answer

CHAR is fixed-length character data; VARCHAR is variable-length up to its declared length. NOT NULL rejects missing values; UNIQUE prevents duplicate non-NULL key values, subject to DBMS rules for NULL.

U3-092 marksImportant

Write commands to create database SCHOOL, select it, show its tables and display the structure of STUDENT.

Show answer
SQL
CREATE DATABASE SCHOOL;
USE SCHOOL;
SHOW TABLES;
DESCRIBE STUDENT;
U3-102 marksImportant

Correct the query to find departments having more than two employees.

SQL
SELECT Dept, COUNT(*) FROM EMPLOYEE
WHERE COUNT(*) > 2 GROUP BY Dept;
Show answer
SQL
SELECT Dept,COUNT(*) FROM EMPLOYEE GROUP BY Dept HAVING COUNT(*)>2;
Table STUDENT (used in U3-11 to U3-15 and U3-24)
SIDNameHouseMarksCity
1AshaRed84Khurja
2BilalBlue76Aligarh
3CharuRed92Khurja
4DevBlueNULLDelhi
5EshaGreen68Aligarh
6FarhanRed80Khurja
U3-113 marksImportant

Write queries to display (i) Name and Marks for Marks BETWEEN 75 AND 85, (ii) records from Khurja or Delhi using IN, (iii) names ending in a.

Show answer
SQL
SELECT Name,Marks FROM STUDENT WHERE Marks BETWEEN 75 AND 85;
SELECT * FROM STUDENT WHERE City IN ('Khurja','Delhi');
SELECT Name FROM STUDENT WHERE Name LIKE '%a';
U3-123 marksImportant

Write queries to display (i) records with missing Marks, (ii) distinct cities alphabetically, (iii) names and marks in descending Marks order.

Show answer
SQL
SELECT * FROM STUDENT WHERE Marks IS NULL;
SELECT DISTINCT City FROM STUDENT ORDER BY City;
SELECT Name,Marks FROM STUDENT ORDER BY Marks DESC;
U3-133 marksImportant

Predict (i) COUNT(*) and COUNT(Marks), (ii) MIN(Marks) and MAX(Marks), (iii) SUM(Marks) for Red house.

Show answer

(6,5); (68,92); 256.

U3-143 marksImportant

Write queries for (i) house-wise student counts, (ii) house-wise average Marks with alias AverageMarks, (iii) houses with average Marks > 80.

Show answer
SQL
SELECT House,COUNT(*) FROM STUDENT GROUP BY House;
SELECT House,AVG(Marks) AS AverageMarks FROM STUDENT GROUP BY House;
SELECT House,AVG(Marks) FROM STUDENT GROUP BY House HAVING AVG(Marks)>80;
U3-154 marksImportant

Independently (i) insert (7,Gauri,Green,88,Delhi), (ii) increase Red-house marks by 2, (iii) delete SID 4, (iv) display Name and Marks+5 with alias Adjusted for non-NULL Marks.

Show answer
SQL
INSERT INTO STUDENT VALUES(7,'Gauri','Green',88,'Delhi');
UPDATE STUDENT SET Marks=Marks+2 WHERE House='Red';
DELETE FROM STUDENT WHERE SID=4;
SELECT Name,Marks+5 AS Adjusted FROM STUDENT WHERE Marks IS NOT NULL;
Tables COURSE and ENROL (used in U3-16 to U3-18)
CIDCNameFee
C1Python4000
C2SQL3500
C3Networks3000
EIDLearnerCID
101AmanC1
102BhavnaC2
103ChiragC1
104DiyaC3
U3-163 marksImportant

Write equi-join queries to show (i) each learner and course name, (ii) learner and Fee where Fee >= 3500, (iii) learner count for each course.

Show answer
SQL
SELECT E.Learner,C.CName FROM ENROL E,COURSE C WHERE E.CID=C.CID;
SELECT E.Learner,C.Fee FROM ENROL E,COURSE C WHERE E.CID=C.CID AND C.Fee>=3500;
SELECT C.CName,COUNT(*) FROM ENROL E,COURSE C WHERE E.CID=C.CID GROUP BY C.CName;
U3-172 marksImportant

How many rows and columns result from (i) COURSE CROSS JOIN ENROL, (ii) COURSE NATURAL JOIN ENROL? CID is their only common column.

Show answer

Cross join: 12 rows, 6 columns. Natural join: 4 rows, 5 columns.

U3-183 marksImportant

Predict this result, then explain why CID must be the intended common joining attribute.

SQL
SELECT Learner,CName FROM COURSE NATURAL JOIN ENROL
ORDER BY Learner;
Show answer

Aman Python; Bhavna SQL; Chirag Python; Diya Networks. NATURAL JOIN joins on all identically named columns; here CID is the only common name and represents the course identifier.

U3-194 marksImportant

Create BOOK(BookID INT,Title VARCHAR(40),Price FLOAT,PurchaseDate DATE), making BookID the primary key and Title NOT NULL. Then write commands to add Shelf CHAR(5), remove Shelf, and drop BOOK. Treat the final three operations sequentially.

Show answer
SQL
CREATE TABLE BOOK(BookID INT PRIMARY KEY, Title VARCHAR(40) NOT NULL, Price FLOAT, PurchaseDate DATE);
ALTER TABLE BOOK ADD Shelf CHAR(5);
ALTER TABLE BOOK DROP COLUMN Shelf;
DROP TABLE BOOK;
U3-203 marks

For an existing ITEM table whose ItemID values are unique and non-NULL, add a primary key on ItemID, then remove that primary key. Give commands to show all databases and drop a practice database named TEMPDB.

Show answer
SQL
ALTER TABLE ITEM ADD PRIMARY KEY(ItemID);
ALTER TABLE ITEM DROP PRIMARY KEY;
SHOW DATABASES;
DROP DATABASE TEMPDB;

Use these as written exercises on a practice database only.

U3-214 marksImportant

Write a complete Python program to connect to a local MySQL database SCHOOL using practice credentials user="student", password="practice" and display STUDENT rows with Marks >= 80. Use execute(), fetchall() and close the cursor and connection.

Show answer

Assumes mysql.connector and the stated local practice database/account are available:

Python
import mysql.connector as mysql
con = mysql.connect(host='localhost',user='student',
                    password='practice',database='SCHOOL')
cur = con.cursor()
cur.execute('SELECT * FROM STUDENT WHERE Marks >= %s',(80,))
for row in cur.fetchall():
    print(row)
cur.close()
con.close()
U3-224 marksImportant

Using an established connection con and cursor cur, accept SID and new Marks, update the matching student using parameter placeholders, commit, and print the affected-row count.

Show answer

One valid solution:

Python
sid = int(input('SID: '))
marks = int(input('New marks: '))
cur.execute('UPDATE STUDENT SET Marks=%s WHERE SID=%s',
            (marks,sid))
con.commit()
print(cur.rowcount)
U3-234 marksImportant

Using con and cur, insert (7,Gauri,Green,88,Delhi) with a parameterized query and commit. Then delete SID 7 with a parameterized query and commit. Explain the purpose of commit().

Show answer

commit() finalizes the transaction changes in this transactional example.

Python
cur.execute('INSERT INTO STUDENT VALUES(%s,%s,%s,%s,%s)',
            (7,'Gauri','Green',88,'Delhi'))
con.commit()
cur.execute('DELETE FROM STUDENT WHERE SID=%s',(7,))
con.commit()
U3-243 marksImportant

With the original STUDENT data from U3-11, predict each print using the default cursor. Explain what fetchone() returns after exhaustion.

Python
cur.execute('SELECT SID,Name FROM STUDENT ORDER BY SID')
print(cur.fetchone())
print(cur.fetchone())
rest = cur.fetchall()
print(len(rest))
print(cur.fetchone())
Show answer

(1, 'Asha'); (2, 'Bilal'); 4; None. fetchone() returns None when no rows remain.

Part B – Previous year board questions (Unit 3)

CBSE Board Paper 2026 – 10 questions

Board 2026 · Q12
CBSE 2026 Class 12 CS board question Q12, Unit 3 Database Management
Show answer

(B) 1

Board 2026 · Q13
CBSE 2026 Class 12 CS board question Q13, Unit 3 Database Management
Show answer

(B) ALTER TABLE

Board 2026 · Q14
CBSE 2026 Class 12 CS board question Q14, Unit 3 Database Management
Show answer

(D) ID and name of machines with quantity less than or equal to 100 from INVENTORY table.

Board 2026 · Q15
CBSE 2026 Class 12 CS board question Q15, Unit 3 Database Management
Show answer

(C) 6 – cardinality is the number of tuples: 2 + 4 = 6 (deleting attributes changes only the degree).

Board 2026 · Q16
CBSE 2026 Class 12 CS board question Q16, Unit 3 Database Management
Show answer

(A) MIN()

Board 2026 · Q21
CBSE 2026 Class 12 CS board question Q21, Unit 3 Database Management
Show answer

(C) – Assertion is true, Reason is false: a primary key is chosen from the candidate keys.

Board 2026 · Q27
CBSE 2026 Class 12 CS board question Q27, Unit 3 Database Management
Show answer

(i) (a)

SQL
CREATE TABLE W_STOCK (
    W_Code        CHAR(5) PRIMARY KEY,
    W_Description VARCHAR(20),
    B_Qty         INT,
    U_Price       FLOAT
);

OR (b) No. Different items can have the same unit price, so U_Price is not unique and cannot identify each record.

(ii) (a)

SQL
ALTER TABLE W_STOCK ADD E_Date DATE;

OR (b)

SQL
ALTER TABLE W_STOCK DROP COLUMN B_Qty;
Board 2026 · Q32
CBSE 2026 Class 12 CS board question Q32, Unit 3 Database Management (part 1)CBSE 2026 Class 12 CS board question Q32, Unit 3 Database Management (part 2)
Show answer

(a)

SQL
SELECT Type, MAX(Price) FROM STOCK GROUP BY Type;            -- (i)
UPDATE STOCK SET Price = Price + 0.5 WHERE Type = 'F';       -- (ii)
SELECT SUM(Qty * Price) FROM STOCK;                          -- (iii)
SELECT * FROM STOCK WHERE Code LIKE 'A%';                    -- (iv)

OR (b)

(i) 0.5 300 38.00; 0.5 250 36.50; 1.0 50 52.00

(ii) AF0.5 300; MF0.5 250; PT0.5 78

(iii) F, T, D

(iv) 0.5 → 3; 1.0 → 3

Board 2026 · Q34
CBSE 2026 Class 12 CS board question Q34, Unit 3 Database Management (part 1)CBSE 2026 Class 12 CS board question Q34, Unit 3 Database Management (part 2)
Show answer
SQL
SELECT COUNT(*) FROM LOANS WHERE RoI > 7.0;                                  -- (i)
SELECT C.C_Name FROM CUSTOMERS C, LOANS L
WHERE C.C_ID = L.C_ID AND L.L_Amt > 1000000;                                 -- (ii)
SELECT C.C_ID, C.C_Name, L.Terms FROM CUSTOMERS C, LOANS L
WHERE C.C_ID = L.C_ID AND L.L_Date > '2024-12-31';                           -- (iii)
SELECT * FROM LOANS ORDER BY RoI DESC;                                       -- (iv)(a)
SELECT C_ID, AVG(Terms) FROM LOANS GROUP BY C_ID;                            -- OR (iv)(b)
Board 2026 · Q35
CBSE 2026 Class 12 CS board question Q35, Unit 3 Database Management
Show answer
Python
import mysql.connector as mysql

con = mysql.connect(host="localhost", user="admin", password="root", database="SCHOOL")
cur = con.cursor()
cur.execute("SELECT * FROM Account WHERE Fees < %s", (5000,))
for row in cur.fetchall():
    print(row)
cur.close()
con.close()

CBSE Board Paper 2023 – 9 questions

Board 2023 · Q10
CBSE 2023 Class 12 CS board question Q10, Unit 3 Database Management
Show answer

(d) Cardinality

Board 2023 · Q12
CBSE 2023 Class 12 CS board question Q12, Unit 3 Database Management
Show answer

(b) ORDER BY

Board 2023 · Q16
CBSE 2023 Class 12 CS board question Q16, Unit 3 Database Management
Show answer

(b) List of tuples

Board 2023 · Q22
CBSE 2023 Class 12 CS board question Q22, Unit 3 Database Management
Show answer

Candidate keys that are not chosen as the primary key are called alternate keys. Example: in STUDENT(AdmNo, RollNo, AadhaarNo, Name), AdmNo and AadhaarNo are both unique (candidate keys). If AdmNo is made the primary key, AadhaarNo becomes an alternate key.

Board 2023 · Q25
CBSE 2023 Class 12 CS board question Q25, Unit 3 Database Management
Show answer

(a) CHAR(n) is fixed-length: it always uses n characters, padding with spaces (CHAR(10) storing 'Ram' uses 10 characters). VARCHAR(n) is variable-length: it uses only the space needed up to n (VARCHAR(10) storing 'Ram' uses 3 characters). CHAR suits fixed codes (e.g. PIN, gender); VARCHAR suits names/addresses.

OR (b) DDL: CREATE, ALTER (also DROP). DML: INSERT, UPDATE (also DELETE, SELECT).

Board 2023 · Q26
CBSE 2023 Class 12 CS board question Q26, Unit 3 Database Management (part 1)CBSE 2023 Class 12 CS board question Q26, Unit 3 Database Management (part 2)
Show answer

(a) Natural join on LOAN_NO gives 2 rows (L-170 RAVYA, L-230 KRISH) and 4 columns (LOAN_NO, B_NAME, AMOUNT, CUST_NAME).

(b)

(i) STATE in descending order: SAHIL KANPUR, VEDA KANPUR, SAMEER ROOP NAGAR, MAHIR SONIPAT, MARY DELHI, ATHARVA DELHI (rows of the same state may appear in any order)

(ii) KANPUR, ROOP NAGAR, DELHI, SONIPAT

(iii) SAHIL UTTAR PRADESH; MAHIR HARYANA; VEDA UTTAR PRADESH (second and third letters 'HA': KHAN, SHARMA)

(iv) KANPUR 2; ROOP NAGAR 1; DELHI 2; SONIPAT 1

Board 2023 · Q28
CBSE 2023 Class 12 CS board question Q28, Unit 3 Database Management
Show answer

(a)

(i) MIN = 200, MAX = 4300

(ii) LOGITECH 2; CANON 2

(iii) KEYBOARD 2; MOUSE 3; JOYSTICK 2

(iv) LASER PRINTER CANON 1; KEYBOARD LOGITECH 2; MOUSE LOGITECH 2; JOYSTICK IBALL 1

(b)

SQL
SHOW DATABASES;
Board 2023 · Q32(b)
CBSE 2023 Class 12 CS board question Q32(b), Unit 3 Database Management (part 1)CBSE 2023 Class 12 CS board question Q32(b), Unit 3 Database Management (part 2)CBSE 2023 Class 12 CS board question Q32(b), Unit 3 Database Management (part 3)
Show answer

Delete version:

Python
import mysql.connector as mysql                                  # Statement 1
mycursor.execute("DELETE FROM employee WHERE E_code = 'E101'")   # Statement 2
mydb.commit()                                                    # Statement 3

OR – Display version:

Python
import mysql.connector as mysql                                  # Statement 1
mycursor.execute("SELECT * FROM employee WHERE City = 'Delhi'")  # Statement 2
details = mycursor.fetchall()                                    # Statement 3
Board 2023 · Q34
CBSE 2023 Class 12 CS board question Q34, Unit 3 Database Management
Show answer

(i) LABNO and LAB_NAME (both unique for every lab).

(ii) Degree = 5, Cardinality = 5

(iii)

SQL
INSERT INTO LAB VALUES ('L006', 'PHYSICS', 'Ravi', 25, 'II');        -- (a)
UPDATE LAB SET CAPACITY = CAPACITY + 10 WHERE FLOOR = 'I';            -- (b)

OR (iii)

SQL
ALTER TABLE LAB ADD PRIMARY KEY (LABNO);     -- (a)
DROP TABLE LAB;                              -- (b)

CBSE Board Paper 2022 (Term-2, 35 marks) – 8 questions

Board 2022 · Q3
CBSE 2022 Class 12 CS board question Q3, Unit 3 Database Management
Show answer

An attribute is a column (field) of a relation, e.g. Name in STUDENT. A domain is the set of all allowed values that an attribute can take, e.g. the domain of Gender is {M, F}. Every attribute takes its values from its domain.

Board 2022 · Q4
CBSE 2022 Class 12 CS board question Q4, Unit 3 Database Management
Show answer

The first fetchone() reads M1001 (not printed); the loop then fetches and prints the next two GYM rows:

Output
M1002#Pratik
M1004#Rakesh
Board 2022 · Q5
CBSE 2022 Class 12 CS board question Q5, Unit 3 Database Management
Show answer

(a) Harjot 55; Srikanth 43

(b) Delhi 2; Kolkata 1; Mumbai 2

(c) Delhi, Mumbai, Kolkata

(d) MAX(Dose1) = 2022-01-01, MIN(Dose2) = 2021-07-20

Board 2022 · Q6
CBSE 2022 Class 12 CS board question Q6, Unit 3 Database Management (part 1)CBSE 2022 Class 12 CS board question Q6, Unit 3 Database Management (part 2)
Show answer

(a) Natural join on DNO (P3 has NULL, so it is left out):

AMITABH NOOR; ANIKET ANNIE; AMITABH HARMEET

(b) NOOR 2021-12-25 1500; HARMEET 2019-12-20 1500

Board 2022 · Q7
CBSE 2022 Class 12 CS board question Q7, Unit 3 Database Management (part 1)CBSE 2022 Class 12 CS board question Q7, Unit 3 Database Management (part 2)
Show answer

A candidate key is any attribute (or set of attributes) that can uniquely identify each tuple of a relation; a table may have several. The primary key is the one candidate key chosen by the designer to identify the tuples; it cannot be NULL. The remaining candidate keys are alternate keys.

OR (a) PNO (b) Degree is the number of attributes (columns) of a relation. Degree of PLAYER = 3.

Board 2022 · Q9
CBSE 2022 Class 12 CS board question Q9, Unit 3 Database Management
Show answer

(i)

SQL
ALTER TABLE ITEMS DROP COLUMN DISCOUNT;

(ii) DDL: CREATE, DROP. DML: UPDATE, INSERT.

Board 2022 · Q10
CBSE 2022 Class 12 CS board question Q10, Unit 3 Database Management
Show answer
SQL
USE LIBRARY;        -- (a)
SHOW TABLES;        -- (b)
DESCRIBE BOOKS;     -- (c)
Board 2022 · Q11
CBSE 2022 Class 12 CS board question Q11, Unit 3 Database Management (part 1)CBSE 2022 Class 12 CS board question Q11, Unit 3 Database Management (part 2)
Show answer
SQL
UPDATE FLIGHT SET FARE = 6000 WHERE FNO = 'F104';                        -- (a)
SELECT GENDER, COUNT(*) FROM PASSENGER GROUP BY GENDER;                  -- (b)
SELECT P.NAME, F.FARE, F.F_DATE FROM PASSENGER P, FLIGHT F
WHERE P.FNO = F.FNO AND F.START = 'DELHI';                               -- (c)
DELETE FROM FLIGHT WHERE END = 'MUMBAI';                                 -- (d)
Next

Next: prepare your Practical File and choose a Project.

← Class 12 Computer Science
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

Next topicPractical File 2026-27 (Programs + SQL) Your progress: 21 / 24 (88%) · Lesson 22 / 24 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free