SQL: DDL, DML and Queries Class 12 PYQs 2024–2026 with Solutions | CBSE Computer Science Skip to content
Smart Notes for Every Exam · instant PDF download after payment +91 92520 37565
Class 12 · Computer Science · Chapter 12

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.

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

SQL: DDL, DML and Queries: board weightage

Board weightage 2024–2026

Year202420252026
Questions453
Marks794

Most asked topics

DDL commands8
SELECT with conditions3
SQL queries1

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

Q1 · CBSE 2026 · 91 · Q131 mark

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

Q2 · CBSE 2026 · 91 · Q141 mark

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.

Q3 · CBSE 2025 · 91 · Q91 mark

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.

Q4 · CBSE 2025 · 91 · Q131 mark

Which is a DML command? (A) UPDATE (B) CREATE (C) ALTER (D) DROP

Solution

(A) UPDATE.

Q5 · CBSE 2025 · 91 · Q151 mark

In MySQL, which type of value should not be enclosed within quotation marks? (A) DATE (B) VARCHAR (C) FLOAT (D) CHAR

Full step-by-step solution is in the PYQ book (₹99).
Q6 · CBSE 2024 · 91 · Q21 mark

SELECT combined with ____ clause returns records without repetition. (a) DISTINCT (b) DESCRIBE (c) UNIQUE (d) NULL

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

Which is not a DDL command? (a) DROP (b) CREATE (c) UPDATE (d) ALTER

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

2 marks: very short answer

Q8 · CBSE 2026 · 91 · Q272 marks

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
( 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;
(i)(b) No: U_Price may contain duplicate (two items with the same price) and NULL values, so it cannot uniquely identify records.

Q9 · CBSE 2025 · 91 · Q272 marks

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;

Q10 · CBSE 2024 · 91 · Q242 marks

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

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

3 marks: short answer

Q11 · CBSE 2024 · 91 · Q293 marks

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

Q12 · CBSE 2025 · 91 · Q32(A)4 marks

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

Get every solution for all chapters

  • Every board question of every chapter, each fully solved the way the board gives marks
  • 3 complete board papers, each followed by its solutions
  • Weightage and most-asked topics for every chapter
  • Instant PDF download, colour and black & white print copies
See real pages (free sample)

Revising the chapter first? Complete Computer Science Notes for Class 12 (CBSE 083, 2026-27) →

What you get in the pack

All chapters in this pack

  1. PYQ Ch 1 Python Revision Tour
  2. PYQ Ch 2 Functions
  3. PYQ Ch 3 Exception Handling
  4. PYQ Ch 4 Text Files
  5. PYQ Ch 5 Binary Files
  6. PYQ Ch 6 CSV Files
  7. PYQ Ch 7 Stack
  8. PYQ Ch 8 Computer Networks I: Evolution and Data Communication
  9. PYQ Ch 9 Computer Networks II: Devices, Topologies and Types
  10. PYQ Ch 10 Network Protocols and Web Services
  11. PYQ Ch 11 Database Concepts
  12. PYQ Ch 12 SQL: DDL, DML and Queries
  13. PYQ Ch 13 SQL: Aggregates, Grouping and Joins
  14. PYQ Ch 14 Interface of Python with MySQL
  15. Board Paper 2026 Set 91 with Solutions
  16. Board Paper 2025 Set 91 with Solutions
  17. Board Paper 2024 Set 91 with Solutions
← PYQ Ch 11 Database Concepts PYQ Ch 13 SQL: Aggregates, Grouping and Joins →

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