Board Q&A · Class 12 Informatics Practices

MySQL SQL Revision Tour: Class 12 CBSE Previous-Year Questions with Answers

CBSE Question Papers →

30 questions from CBSE board, sample and compartment papers (2024–2027), 1 to 5 marks, each with a model answer. Questions on database concepts and keys, DDL and DML commands, CREATE TABLE with constraints, ALTER, UPDATE, DELETE and DROP, data types, and SELECT queries with WHERE, BETWEEN and other conditions.

Showing 30 of 292 questions
Group

MySQL SQL Revision Tour

30 Questions
MySQL SQL Revision Tour· 1 Mark· Q8· 2024 Board Paper
Which MySQL command helps to add a primary key constraint to any table that has already been created?
  1. (A)(i) UPDATE
  2. (B)(ii) INSERT INTO
  3. (C)(iii) ALTER TABLE
  4. (D)(iv) ORDER BY
MySQL SQL Revision Tour· 1 Mark· Q11· 2024 Board Paper
Which of the following clause cannot work with SELECT statement in MYSQL?
  1. (A)(i) FROM
  2. (B)(ii) INSERT INTO
  3. (C)(iii) WHERE
  4. (D)(iv) GROUP BY
MySQL SQL Revision Tour· 2 Marks· Q25· 2024 Board Paper
Write any two differences between UPDATE and ALTER TABLE commands of MySQL.
MySQL SQL Revision Tour· 3 Marks· Q28· 2024 Board Paper
Answer the following questions based on the table Salesman given below: Table : Salesman salesman_id | name | city | commission 5001 | Neil Bhatt | Delhi | 0.15 5002 | Rohan Malik | Mumbai | 0.13 5005 | Ravi Mohan | Delhi | 0.11 5006 | Mehak Rai | Delhi | 0.14 5007 | Paul Lal | Bangalore | 0.13 5003 | Raman Sen | Kolkata | 0.12 (i) How many tuples does the given table have? (ii) Suggest the primary key for the given table. (iii) Write the MySQL query to display all the records in descending order of commission.
MySQL SQL Revision Tour· 4 Marks· Q31· 2024 Board Paper
Rupam created a MySQL table to store the details of Nobel prize winners. Help her to write the following MySQL queries: TABLE : NOBEL Winner_Id | YEAR | SUBJECT | WINNER | COUNTRY | CATEGORY 1001 | 1970 | Physics | Hannes Alfven | Sweden | Scientist 1002 | 1970 | Physiology | Bernard Katz | NULL | Scientist 1003 | 1970 | Literature | Aleksandr Solzhenitsyn | Russia | Linguist 1004 | 1971 | Chemistry | Gerhard Herzberg | Germany | Scientist 1005 | 1978 | Peace | Menachem Begin | Israel | Prime Minister 1006 | 1987 | Economics | Robert Solow | USA | Economist 1007 | 1994 | Literature | Kenzaburo Oe | Japan | Linguist (i) Display the names of Nobel Prize winner in 'Literature' for the year 1970. (ii) Display the subject and category of winners whose country is not known. (iii) Display the details of all Nobel Prize winners who were Scientists. (iv) Count total number of winners whose subject is Literature.
MySQL SQL Revision Tour· 5 Marks· Q33· 2024 Board Paper
Excellent Consultancy Pvt. Ltd. maintains two tables for all its employees. Table : Employee Employee_id | First_name | Last_name | Salary | Joining_date | Department E101 | Monika | Das | 100000 | 2019-01-20 | Finance E102 | Mehak | Verma | 600000 | 2019-01-15 | IT E103 | Manan | Pant | 890000 | 2019-02-05 | Banking E104 | Shivam | Agarwal | 200000 | 2019-02-25 | Insurance E105 | Alisha | Singh | 220000 | 2019-02-28 | Finance E106 | Poonam | Sharma | 400000 | 2019-05-10 | IT E107 | Anshuman | Mishra | 123000 | 2019-06-20 | Banking Table : Reward Employee_id | Date_reward | Amount E101 | 2019-05-11 | 1000 E102 | 2019-02-15 | 5000 E103 | 2019-04-22 | 2000 E106 | 2019-06-20 | 8000 Write suitable SQL queries to perform the following task: (i) Change the Department of Shivam to IT in the table Employee. (ii) Remove the record of Alisha from the table Employee. (iii) Add a new column Experience of integer type in the table Employee. (iv) Display the first name, last name and amount of reward for all employees from the tables Employee and Reward. (v) Display first name and salary of all the employees whose amount is less than 2000 from the tables Employee and Reward. OR Write suitable SQL queries for the following task: (i) Display the year of joining of all the employees from the table Employee. (ii) Display each department name and its corresponding average salary. (iii) Display the first name and date of reward of those employees who joined on Monday from the tables Employee and Reward. (iv) Display sum of salary of those employees whose reward amount is greater than 3000 from the tables Employee and Reward. (v) Remove the table Reward.
MySQL SQL Revision Tour· 2 Marks· Q26· 2025 Board Paper
What is a Database Management System (DBMS)? Mention any two examples of DBMS.
MySQL SQL Revision Tour· 3 Marks· Q31· 2025 Board Paper
(i) Write the SQL statement to create a table, Customer with the following specifications: Table: Customer Column Name | Data Type | Key CID | Int | Primary Key FName | Varchar(20) | LName | Varchar(20) | Age | Int | (ii) Write the SQL query to display all records in descending order of LName from the Table Customer.
MySQL SQL Revision Tour· 1 Mark· Q11· 2026 Board Paper
Which of the following is the correct expanded form of DML?
  1. (A)Device Management Language
  2. (B)Device Manipulation Language
  3. (C)Data Management Language
  4. (D)Data Manipulation Language
MySQL SQL Revision Tour· 2 Marks· Q24· 2026 Board Paper
Define the following terms with respect to RDBMS: a. Domain b. Tuple
MySQL SQL Revision Tour· 3 Marks· Q31· 2026 Board Paper
(i) Write an SQL statement to create a table named PRODUCTS with the following specifications: Column Name | Data Type | Key --- | --- | --- PId | Integer | Primary Key PName | Varchar of size 30 | PCat | Char of size 15 | Price | Decimal Number | (ii) Write an SQL query to increase the price of all items by 100, whose product category is Grocery, in the table PRODUCTS.
MySQL SQL Revision Tour· 1 Mark· Q16· 2025 Compartment Paper
The ALTER command in SQL can be used to:
  1. (A)Alter data within a table
  2. (B)Delete data from a table
  3. (C)Modify the structure of a table
  4. (D)Create a new table
MySQL SQL Revision Tour· 1 Mark· Q21· 2025 Compartment Paper
Assertion (A): There can be multiple primary keys in a relation. Reason (R): There can be multiple candidate keys in a relation but only one of these is chosen as primary key.
MySQL SQL Revision Tour· 3 Marks· Q31· 2025 Compartment Paper
(a) Write the SQL statement to create a table Customer with the following specifications: Table: Customer Column Name | Data Type | Key CID | Numeric | Primary Key Name | Varchar(50) | Dob | Date | Phone | Varchar(15) | (b) Write the SQL query to display the total number of records in the table Customer.
MySQL SQL Revision Tour· 4 Marks· Q34· 2025 Compartment Paper
(a) Moulik is a database manager at a retail company. The company maintains a Customer table in their database to track customer information. Table: Customer custid | cust_name | city | age | email | phone Write SQL queries to: (i) Retrieve the list of all customers who are less than 30. Display the custid, cust_name and age. (ii) Find the minimum age of all customers from each city. (iii) Find all customers whose city is Nagpur. Display the custid, cust_name and email. (iv) Change the phone number of Trisha to 8995715156. OR (b) Write the output of the following SQL queries based on table STATIONERY: (i) Select UPPER(ITEM_NAME) from STATIONERY where CATEGORY = 'WRITING'; (ii) Select ITEM_NAME from STATIONERY where month(PUR_DATE)=4; (iii) Select ITEM_NAME from STATIONERY where QTY<50; (iv) Select count(*) from STATIONERY where CATEGORY = 'OFFICE';
MySQL SQL Revision Tour· 1 Mark· Q11· 2024 Sample Paper
With reference to SQL, identify the invalid data type.
  1. (A)i. Date
  2. (B)ii. Integer
  3. (C)iii. Varchar
  4. (D)iv. Month
MySQL SQL Revision Tour· 3 Marks· Q28· 2024 Sample Paper
Write MySQL statements for the following: i. To create a database named FOOD. ii. To create a table named Nutrients based on the following specification: Column Name | Data Type | Constraints Food_Item | Varchar(20) | Primary Key Calorie | Integer |
MySQL SQL Revision Tour· 1 Mark· Q2· 2025 Sample Paper
The purpose of WHERE clause in a SQL statement is to:
  1. (A)Create a table
  2. (B)Filter rows based on a specific condition
  3. (C)Specify the columns to be displayed
  4. (D)Sort the result based on a column
MySQL SQL Revision Tour· 1 Mark· Q4· 2025 Sample Paper
Identify the SQL command used to delete a relation (table) from a relational database.
  1. (A)DROP TABLE
  2. (B)REMOVE TABLE
  3. (C)DELETE TABLE
  4. (D)ERASE TABLE
MySQL SQL Revision Tour· 1 Mark· Q21· 2025 Sample Paper
Assertion (A): In SQL, INSERT INTO is a Data Definition Language (DDL) Command. Reason (R): DDL commands are used to create, modify, or remove database structures, such as tables.
  1. (A)Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A)
  2. (B)Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A)
  3. (C)Assertion (A) is True, but Reason (R) is False
  4. (D)Assertion (A) is False, but Reason (R) is True
MySQL SQL Revision Tour· 2 Marks· Q26· 2025 Sample Paper
Define the term Primary Key in a database. Explain how it is different from a Candidate Key.
MySQL SQL Revision Tour· 3 Marks· Q31· 2025 Sample Paper
I. Write an SQL statement to create a table named STUDENTS, with the following specifications: Column Name | Data Type | Key StudentID | Numeric | Primary Key FirstName | Varchar(20) | LastName | Varchar(10) | DateOfBirth | Date | Percentage | Float(10,2) | II. Write SQL Query to insert the following data in the Students Table: 1, Supriya, Singh, 2010-08-18, 75.5
MySQL SQL Revision Tour· 1 Mark· Q9· 2026 Sample Paper
Consider a table named Students that has one primary key and three alternate keys. How many candidate keys does the table have?
  1. (A)1
  2. (B)2
  3. (C)3
  4. (D)4
MySQL SQL Revision Tour· 1 Mark· Q21· 2026 Sample Paper
Assertion (A): The INSERT INTO command is a DML (Data Manipulation Language) command. Reason (R): DML commands are used to insert, update or delete the data stored in a database.
  1. (A)Both A and R are True, and R correctly explains A.
  2. (B)Both A and R are True, but R does not correctly explain A.
  3. (C)A is True, but R is False.
  4. (D)A is False, but R is True.
MySQL SQL Revision Tour· 3 Marks· Q31· 2026 Sample Paper
I. Write an SQL statement to create a table named EMPLOYEES, with the following specifications: Column Name | Data Type | Key EmployeeID | Numeric | Primary Key EmpName | Varchar(25) | HireDate | Date | Salary_in_Lacs | Float(4,2) | II. Write an SQL Query to insert the following data into the EMPLOYEES table: 101, Ravi Kumar, 2015-06-01, 1.70
MySQL SQL Revision Tour· 1 Mark· Q6· 2027 Sample Paper
Which of the following is a Data Manipulation Language (DML) command in SQL?
  1. (A)ALTER
  2. (B)DROP
  3. (C)UPDATE
  4. (D)CREATE
MySQL SQL Revision Tour· 1 Mark· Q17· 2027 Sample Paper
A HR manager queries an employee database. He wants to retrieve only those records where the Commission field actually contains a value. Which SQL condition should he use?
  1. (A)WHERE Commission != NULL
  2. (B)WHERE Commission IS NOT NULL
  3. (C)WHERE Commission <> NULL
  4. (D)WHERE Commission NOT NULL
MySQL SQL Revision Tour· 1 Mark· Q19· 2027 Sample Paper
State whether the following statement is True or False: In SQL, the BETWEEN operator is inclusive of both the lower and upper values specified in the range.
MySQL SQL Revision Tour· 1 Mark· Q21· 2027 Sample Paper
Assertion (A) In SQL, the query select * from emp; and SELECT * FROM EMP; will produce the same result. Reason (R) SQL is a case-sensitive language.
  1. (A)Both Assertion (A) and Reason (R) are True and Reason (R) is the correct explanation for Assertion (A).
  2. (B)Both Assertion (A) and Reason (R) are True and Reason (R) is not the correct explanation for Assertion (A).
  3. (C)Assertion (A) is True and Reason (R) is False.
  4. (D)Assertion (A) is False, but Reason (R) is True.
MySQL SQL Revision Tour· 5 Marks· Q37· 2027 Sample Paper
(A) Refer to the table given below: Table: BOOK BookID | Title | Author | Price 201 | Wings of Fire | A P J Abdul Kalam | 350 202 | The Guide | R. K. Narayan | 299 203 | The God of Small Things | Arundhati Roy | 399 204 | Malgudi Days | R. K. Narayan | 280 Write SQL commands for the following tasks: (i) Insert a new record into the table with the values: 205, The White Tiger, Aravind Adiga, 350. (ii) Update the Price of the book with BookID 202 to 325. (iii) Delete the records of all books written by 'R. K. Narayan'. (iv) Add a new column Publisher of type VARCHAR(30) to the table. (v) Drop the table BOOK from the database. OR (B) Consider a table named PRODUCT, which contains the following columns: PCode, PName, Category, Qty, Price, ExpiryDate. Write SQL queries for: (i) Display PName and its Price rounded to one decimal place. (ii) Display the names of products that end with the letter 's'. (iii) Display the PName and Category of those products whose Price is less than or equal to 500. (iv) Display the total quantity of all products. (v) Display PName after removing leading spaces only.