SQL: DDL, DML and Queries: Class 12 PYQs 2024–2026 with solutions
All 12 CBSE board questions asked from SQL: DDL, DML and Queries in 3 board papers, with the year, set and marks of each. 8 are solved free below. The Class 12 Computer Science PYQ Book: Solved Board Papers 2024-2026 (CBSE) has every solution, all chapters and 3 full board papers.
SQL: DDL, DML and Queries: board weightage
Board weightage 2024–2026
| Year | 2024 | 2025 | 2026 |
|---|---|---|---|
| Questions | 4 | 5 | 3 |
| Marks | 7 | 9 | 4 |
Most asked topics
12 questions from 3 papers. Repeated questions are shown once with every year they were asked.
Jump to: 1 mark2 marks3 marks4 marks
1 mark: MCQ and Assertion–Reason
Which SQL command can change the degree of an existing relation? (A) DROP TABLE (B) ALTER TABLE (C) UPDATE…SET (D) DELETE
Solution
(B) ALTER TABLE: adding or dropping a column changes the number of attributes (degree).
Output of SELECT MACHINE_ID, MACHINE_NAME FROM INVENTORY WHERE QUANTITY <= 100; (A) all columns, quantity > 100 (B) ID and name, quantity < 100 (C) all columns, quantity ≥ 100 (D) ID and name of machines with quantity less than or equal to 100
Solution
(D). Only the two named columns, and <= includes 100.
While creating a table, which constraint does not allow insertion of duplicate values? (A) UNIQUE (B) DISTINCT (C) NOT NULL (D) HAVING
Solution
(A) UNIQUE.
Which is a DML command? (A) UPDATE (B) CREATE (C) ALTER (D) DROP
Solution
(A) UPDATE.
In MySQL, which type of value should not be enclosed within quotation marks? (A) DATE (B) VARCHAR (C) FLOAT (D) CHAR
SELECT combined with ____ clause returns records without repetition. (a) DISTINCT (b) DESCRIBE (c) UNIQUE (d) NULL
Which is not a DDL command? (a) DROP (b) CREATE (c) UPDATE (d) ALTER
2 marks: very short answer
Table W_STOCK: W_Code CHAR(5), W_Description VARCHAR(20), B_Qty INTEGER, U_Price FLOAT. (i)(a) Create the table with W_Code as primary key. OR (b) Can U_Price be the primary key? Justify. (ii)(a) Add attribute E_Date (DATE). OR (b) Remove column B_Qty.
Solution
(i)(a) CREATE TABLE W_STOCK(i)(b) No: U_Price may contain duplicate (two items with the same price) and NULL values, so it cannot uniquely identify records.
( W_Code CHAR(5) PRIMARY KEY,
W_Description VARCHAR(20),
B_Qty INTEGER,
U_Price FLOAT );
(ii)(a) ALTER TABLE W_STOCK ADD COLUMN E_Date DATE;
(ii)(b) ALTER TABLE W_STOCK DROP COLUMN B_Qty;
Table EMPLOYEES(EMPNO, NAME, DEPARTMENT, BASICSAL); two employees can have the same name. (i)(a) Which attribute should be the PRIMARY KEY? Justify. OR (b) Constraint so that NAME cannot be NULL but can have duplicates. (ii)(a) SQL to change BASICSAL to allow a maximum of 99999.99. OR (b) SQL to delete the table EMPLOYEES.
Solution
(i)(a) EMPNO: every employee's identification number is unique and not null, while names, departments and salaries can repeat. (b) NOT NULL.
(ii)(a) ALTER TABLE EMPLOYEES MODIFY COLUMN BASICSAL FLOAT(7,2); (or DECIMAL(7,2): 7 digits in all, 2 after the point). (b) DROP TABLE EMPLOYEES;
(A) Ms. Veda created table Sports (Game_id, P_Age, G_name); add column Category and insert the record G42, Above 18, Chess, Senior. OR (B) (i) View the list of tables in database Exam. (ii) View the structure of table Term1.
3 marks: short answer
Table Projects(P_id, Pname, Language, Startdate, Enddate). (i) Add the primary key constraint to P_id. (ii) Change the language to Python of project P002. (iii) Delete table Projects along with its data.
Solution
(i) ALTER TABLE Projects ADD PRIMARY KEY (P_id);
(ii) UPDATE Projects SET Language = 'Python' WHERE P_id = 'P002';
(iii) DROP TABLE Projects;
4 marks: SQL / case-based
(a) Table WORKER (above): (i) names and wages of workers with wages between 800 and 1500; (ii) records of workers whose SITEID is not known; (iii) WNAME, WAGE, HOURS of 'Skilled' workers; (iv) change WAGE to 1200 for TYPE "Semiskilled".
Solution
(i) SELECT WNAME, WAGE FROM WORKER WHERE WAGE BETWEEN 800 AND 1500;(i) gives Ahmed J 1500, Anju S 1200; (ii) Nihal K; (iii) Naveen S 520 100, Anju S 1200 130. Part (b) (outputs with COUNT/GROUP BY) is solved in Chapter 13.
(ii) SELECT * FROM WORKER WHERE SITEID IS NULL;
(iii) SELECT WNAME, WAGE, HOURS FROM WORKER WHERE TYPE = 'Skilled';
(iv) UPDATE WORKER SET WAGE = 1200 WHERE TYPE = 'Semiskilled';
Get every solution for all chapters
- Every board question of every chapter, each fully solved the way the board gives marks
- 3 complete board papers, each followed by its solutions
- Weightage and most-asked topics for every chapter
- Instant PDF download, colour and black & white print copies
Revising the chapter first? Complete Computer Science Notes for Class 12 (CBSE 083, 2026-27) →
What you get in the pack
- CBSE Class 12 Computer Science board papers 2024 to 2026 (3 full board papers)
- All 14 chapters and 3 board papers complete
- Part A: all 14 chapters, questions sorted chapter-wise and by marks
- Year-wise weightage table and most-asked topics for every chapter
- Part B: each full board paper followed by its complete solutions
- Full programs; every output traced and verified by running the code
- Only the current syllabus in Part A
All chapters in this pack
- PYQ Ch 1 Python Revision Tour
- PYQ Ch 2 Functions
- PYQ Ch 3 Exception Handling
- PYQ Ch 4 Text Files
- PYQ Ch 5 Binary Files
- PYQ Ch 6 CSV Files
- PYQ Ch 7 Stack
- PYQ Ch 8 Computer Networks I: Evolution and Data Communication
- PYQ Ch 9 Computer Networks II: Devices, Topologies and Types
- PYQ Ch 10 Network Protocols and Web Services
- PYQ Ch 11 Database Concepts
- PYQ Ch 12 SQL: DDL, DML and Queries
- PYQ Ch 13 SQL: Aggregates, Grouping and Joins
- PYQ Ch 14 Interface of Python with MySQL
- Board Paper 2026 Set 91 with Solutions
- Board Paper 2025 Set 91 with Solutions
- Board Paper 2024 Set 91 with Solutions
