Home › Class 12 papers › Computer Science (CS) › Database & SQL
Updated 09 October 2026 · Source: CBSE board papers and marking schemes
Free · Class 12 Computer Science (CS) · 63 questions

Database & SQL: Class 12 Previous Year Questions

Every CBSE board exam question on Database & SQL (Class 12 Computer Science (CS)) from 2022 to 2026, with the years it was asked and the official marking-scheme answer in the free app.

Key facts

Database & SQL questions asked in CBSE board exams

Repeated questions first. Open the free app to see each question as it appeared in the paper, with its marking scheme.

  1. * 25 P a g e 35. Peter has created a table named Account in MySQL database, SCHOOL, having following structure : 4  Stud_id – integer  Sname – string  Class – string  Fees – float Help him in writing a Python program to display records of those students wh…
    Board 20264 marksshort answer
  2. * 7 P a g e 13. Which of the following SQL command can change the degree of the existing relation ? 1 (A) DROP TABLE (B) ALTER TABLE (C) UPDATE…SET (D) DELETE
    Board 20261 markMCQ
  3. * 20 P a g e 32.   STOCK     (table)            data       (set)   Table       (data)     table      : 4  1 = 4 (a)   …
    Board 20264 marksshort answer
  4. * 22 P a g e 34.        (Finance House)                 (tables) : CUSTOMERS  LOANS      tables    (sample data)     : 4  1 = 4 Table:…
    Board 20264 marksshort answer
  5. MySQL     (relation)  2  (tuples)  3  (attributes)    2 Attributes   (delete)    4 tuples       (relation)   (cardinality)   ? 1 (A) 4 (B) 5 (C) 6 (D)
    Board 20261 markMCQ
  6. * 14 P a g e 27.        (Production Manager)     (mineral water)                   (table)            …
    Board 20262 marksshort answer
  7. A table has two candidate keys, one of which is chosen as the primary key. How many alternate keys does this table have ? 1 (A) 0 (B) 1 (C) 2 (D)
    Board 20261 markMCQ
  8.  query  output   ? 1 SELECT MACHINE_ID, MACHINE_NAME FROM INVENTORY WHERE QUANTITY <= 100; (A)  (INVENTORY)  (table)      (quantity) 100     (B)  (INVENTORY)   100    (quantity)  …
    Board 20261 markMCQ
  9. * 8 P a g e 17. Computer Networks   ,      RJ 45      ? 1 (A) Radio Jockey 45 (B) Registered Jockey 45 (C) Radio Jack 45 (D) Registered Jack 45 91* 9 P a g e 14. What will be the output of the query ? 1 SELECT MACHI…
    Board 20261 markMCQ
  10. * 11 P a g e 21. Assertion (A) : The PRIMARY KEY constraint in SQL ensures that each value in the column(s) is unique and cannot be NULL. 1 Reason (R) : Candidate keys are not eligible to become a primary key.  –  (7  2 = 14)
    Board 20261 markAssertion-Reason
  11. (a) (b) PPP PPP· 91 Page 14 of 32 26. The code given below accepts N as an integer argument and returns the sum of all integers from 1 to N. Observe the following code carefully and rewrite it after removing all syntax and logical errors. Underline all the cor…
    Board 20253 marksshort answer
  12. 3 H f (,.·) (Creative Art Gallery (CAG) 3 (IT)(Sculptures· mgfd1gfa(Art creations) m(Artists) (data): (table) Articles Artists 1 4×1 = 4 Table : Articles Code A Code DOC Article Price A0001 Painting 2018-10-19 PL001 20000 SC028 A0004 Sculpture 2021-01-15 16000…
    Board 20255 markslong answer
  13. CINEMA database THEATRE fMT (table) f : 35. Field Type. Th_ID char(5) Name varchar(15) city varchar(15) Location i varchar(15) ISeats iint Delete_Theatre(·function f3qaf (user) Th_ID (Python-Database connectivity): Host : localhost, User : root, Password : Ex2…
    Board 20255 markslong answer
  14. (construction site)(data) WORKER (table)WID·WNAME·WAGE·HOURS, TPE·TEdata WID WNAME WAGE HOURS SITEID 200 w01 Ahmed J 1500 Unskilled 103 w11 Naveen 520 100 Skilled 101 w02 Jacob B 780 95 Unskilled 101 w15 Nihal 560 110 Semiskilled NULL W10 1200 130 Anju skiiled…
    Board 20254 marksshort answer
  15. l. Assertion (A) : We can retrieve records from more than one table in MYSQL. Reason (R) : Foreign key is used to establish a relationship between two tables. 91 Page 1l of 32 (7 × 2 = 14)
    Board 20252 marksAssertion-Reason
  16. (table) 3(constraint) a (duplicate values) faf (insertion) ? (A) UNIQUE (B) DISTINCT (C) NOT NULL (D) HAVING
    Board 20251 markMCQ
  17. MYSQ(value) (Quotation marks) (A) DATE (B) VARCHAR (C) FLOAT (D) CHAR
    Board 20251 markMCQ
  18. (True) (False) : f(table)6 (rows) 3(columns)f 5 2· ·Cartesian product) 30 fa (rows) 3 5 im (columns)
    Board 20251 markvery short
  19. (A) (i) Define cartesian product with respect to RDBMS. 1+4= 5 (i) Sunil wants to write a program in Python to update the quantity to 20 of the records whose item code is 111 in the table named shop in MySQL database named Keeper. The table shop in MySQL conta…
    Board 20245 markscase-based
  20. o. Select the correct output of the following code : event="G20 Presidency@2023" L=event.split(' ') print(L[::-2]) (a) 'G201 (b) ['Presidency@2023'] (c) ['G20'] (d) 'Presidency@2023' 2191
    Board 20241 markMCQ

Practise all 63 Database & SQL questions with answers →

Other Class 12 Computer Science (CS) chapters

Frequently asked questions

How many marks does Database & SQL carry in the CBSE Class 12 Computer Science (CS) board exam?

Across recent CBSE board papers, Database & SQL carried about 21.5 marks per paper on average, making it number 2 of 5 chapters by weightage.

Which years were Database & SQL questions asked in CBSE boards?

Questions from Database & SQL appeared in the 2022, 2023, 2024, 2025, 2026 CBSE Class 12 board exams.

Where can I practise Database & SQL previous year questions for free?

On BoardPrep: all 63 Database & SQL questions are free to practise online, with official CBSE marking-scheme answers where published.