📝 Unit 3 Board Questions + Practice
2026-27 syllabus में Unit 3 के 20 marks हैं। Part A में 24 नए practice questions answers के साथ हैं (पहले ख़ुद हल करें, फिर "Answer देखें" दबाएँ)। Part B में पिछले CBSE board papers (2022, 2023, 2026) के Unit 3 के सभी 27 questions original रूप में हैं – tables, code और internal choice सहित, हर एक के answer के साथ। Questions board paper की तरह English में हैं।
1) पहले unit के lessons पढ़ें। 2) Part A notebook में हल करें, फिर answers मिलाएँ। 3) Part B को paper-wise timer लगाकर हल करें – लगभग 1.5 minute प्रति mark। 4) गलत हुए questions पर निशान लगाएँ और उस lesson को दोबारा पढ़ें।
Part A – Practice questions (answers के साथ)
A relation has 8 rows and 5 columns. State its cardinality and degree.
Answer देखें
Cardinality 8; degree 5.
A table has three candidate keys and one is selected as primary. How many alternate keys remain?
Answer देखें
2.
Which command can add an attribute to an existing table?
Answer देखें
ALTER TABLE … ADD (e.g. ALTER TABLE STUDENT ADD City VARCHAR(20);)
A table has 6 rows, with 2 NULL values in Phone. State COUNT(*) and COUNT(Phone).
Answer देखें
6 and 4.
Which clause filters grouped results: WHERE or HAVING?
Answer देखें
HAVING.
Under the default tuple-returning cursor, what Python structure does fetchall() return?
Answer देखें
A list of tuples.
Explain candidate key and foreign key using STUDENT(SID,Name,CID) and CLASS(CID,ClassName). Assume SID and CLASS.CID uniquely identify records.
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.
Differentiate CHAR(10) and VARCHAR(10). State the purpose of NOT NULL and UNIQUE.
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.
Write commands to create database SCHOOL, select it, show its tables and display the structure of STUDENT.
Answer देखें
CREATE DATABASE SCHOOL; USE SCHOOL; SHOW TABLES; DESCRIBE STUDENT;
Correct the query to find departments having more than two employees.
SELECT Dept, COUNT(*) FROM EMPLOYEE WHERE COUNT(*) > 2 GROUP BY Dept;
Answer देखें
SELECT Dept,COUNT(*) FROM EMPLOYEE GROUP BY Dept HAVING COUNT(*)>2;
| SID | Name | House | Marks | City |
|---|---|---|---|---|
| 1 | Asha | Red | 84 | Khurja |
| 2 | Bilal | Blue | 76 | Aligarh |
| 3 | Charu | Red | 92 | Khurja |
| 4 | Dev | Blue | NULL | Delhi |
| 5 | Esha | Green | 68 | Aligarh |
| 6 | Farhan | Red | 80 | Khurja |
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.
Answer देखें
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';Write queries to display (i) records with missing Marks, (ii) distinct cities alphabetically, (iii) names and marks in descending Marks order.
Answer देखें
SELECT * FROM STUDENT WHERE Marks IS NULL; SELECT DISTINCT City FROM STUDENT ORDER BY City; SELECT Name,Marks FROM STUDENT ORDER BY Marks DESC;
Predict (i) COUNT(*) and COUNT(Marks), (ii) MIN(Marks) and MAX(Marks), (iii) SUM(Marks) for Red house.
Answer देखें
(6,5); (68,92); 256.
Write queries for (i) house-wise student counts, (ii) house-wise average Marks with alias AverageMarks, (iii) houses with average Marks > 80.
Answer देखें
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;
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.
Answer देखें
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;
| CID | CName | Fee |
|---|---|---|
| C1 | Python | 4000 |
| C2 | SQL | 3500 |
| C3 | Networks | 3000 |
| EID | Learner | CID |
|---|---|---|
| 101 | Aman | C1 |
| 102 | Bhavna | C2 |
| 103 | Chirag | C1 |
| 104 | Diya | C3 |
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.
Answer देखें
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;
How many rows and columns result from (i) COURSE CROSS JOIN ENROL, (ii) COURSE NATURAL JOIN ENROL? CID is their only common column.
Answer देखें
Cross join: 12 rows, 6 columns. Natural join: 4 rows, 5 columns.
Predict this result, then explain why CID must be the intended common joining attribute.
SELECT Learner,CName FROM COURSE NATURAL JOIN ENROL ORDER BY Learner;
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.
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.
Answer देखें
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;
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.
Answer देखें
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.
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.
Answer देखें
Assumes mysql.connector and the stated local practice database/account are available:
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()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.
Answer देखें
One valid solution:
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)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().
Answer देखें
commit() finalizes the transaction changes in this transactional example.
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()With the original STUDENT data from U3-11, predict each print using the default cursor. Explain what fetchone() returns after exhaustion.
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())Answer देखें
(1, 'Asha'); (2, 'Bilal'); 4; None. fetchone() returns None when no rows remain.
Part B – पिछले वर्षों के board questions (Unit 3)
CBSE Board Paper 2026 – 10 questions

Answer देखें
(B) 1

Answer देखें
(B) ALTER TABLE

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

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

Answer देखें
(A) MIN()

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

Answer देखें
(i) (a)
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)
ALTER TABLE W_STOCK ADD E_Date DATE;
OR (b)
ALTER TABLE W_STOCK DROP COLUMN B_Qty;


Answer देखें
(a)
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


Answer देखें
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)

Answer देखें
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

Answer देखें
(d) Cardinality

Answer देखें
(b) ORDER BY

Answer देखें
(b) List of tuples

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.

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


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

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)
SHOW DATABASES;



Answer देखें
Delete version:
import mysql.connector as mysql # Statement 1
mycursor.execute("DELETE FROM employee WHERE E_code = 'E101'") # Statement 2
mydb.commit() # Statement 3OR – Display version:
import mysql.connector as mysql # Statement 1
mycursor.execute("SELECT * FROM employee WHERE City = 'Delhi'") # Statement 2
details = mycursor.fetchall() # Statement 3
Answer देखें
(i) LABNO and LAB_NAME (both unique for every lab).
(ii) Degree = 5, Cardinality = 5
(iii)
INSERT INTO LAB VALUES ('L006', 'PHYSICS', 'Ravi', 25, 'II'); -- (a)
UPDATE LAB SET CAPACITY = CAPACITY + 10 WHERE FLOOR = 'I'; -- (b)OR (iii)
ALTER TABLE LAB ADD PRIMARY KEY (LABNO); -- (a) DROP TABLE LAB; -- (b)
CBSE Board Paper 2022 (Term-2, 35 marks) – 8 questions

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.

Answer देखें
The first fetchone() reads M1001 (not printed); the loop then fetches and prints the next two GYM rows:
M1002#Pratik M1004#Rakesh

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


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


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.

Answer देखें
(i)
ALTER TABLE ITEMS DROP COLUMN DISCOUNT;
(ii) DDL: CREATE, DROP. DML: UPDATE, INSERT.

Answer देखें
USE LIBRARY; -- (a) SHOW TABLES; -- (b) DESCRIBE BOOKS; -- (c)


Answer देखें
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)
आगे: अपनी Practical File तैयार करें और Project चुनें।
