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.
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?
(A)(i) UPDATE
(B)(ii) INSERT INTO
(C)(iii) ALTER TABLE
(D)(iv) ORDER BY
Model answer
(iii) ALTER TABLE
Explanation: ALTER TABLE is a DDL command used to alter the structure of an existing table, such as adding constraints (e.g., ADD PRIMARY KEY).
MySQL SQL Revision Tour· 1 Mark· Q11· 2024 Board Paper
Which of the following clause cannot work with SELECT statement in MYSQL?
(A)(i) FROM
(B)(ii) INSERT INTO
(C)(iii) WHERE
(D)(iv) GROUP BY
Model answer
(ii) INSERT INTO
Explanation: INSERT INTO is an independent DML command to add new records, not a clause within a SELECT query.
MySQL SQL Revision Tour· 2 Marks· Q25· 2024 Board Paper
Write any two differences between UPDATE and ALTER TABLE commands of MySQL.
Model answer
| Feature | UPDATE | ALTER TABLE |
|---|---|---|
| Classification | DML (Data Manipulation Language) | DDL (Data Definition Language) |
| Scope | Modifies values inside existing rows/records | Modifies table schema/structure (columns, constraints) |
| WHERE Clause | WHERE clause can be used to select specific rows | WHERE clause cannot be used |
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.
Model answer
(i) 6 tuples (rows)
(ii) Primary Key: salesman_id (it uniquely identifies each record and has non-null distinct values)
(iii) SELECT * FROM Salesman ORDER BY commission DESC;
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.
Model answer
(i) SELECT WINNER FROM NOBEL WHERE SUBJECT = 'Literature' AND YEAR = 1970;
(ii) SELECT SUBJECT, CATEGORY FROM NOBEL WHERE COUNTRY IS NULL;
(iii) SELECT * FROM NOBEL WHERE CATEGORY = 'Scientist';
(iv) SELECT COUNT(*) FROM NOBEL WHERE SUBJECT = 'Literature';
SELECT WINNER FROM NOBEL WHERE SUBJECT = 'Literature' AND YEAR = 1970;
SELECT SUBJECT, CATEGORY FROM NOBEL WHERE COUNTRY IS NULL;
SELECT * FROM NOBEL WHERE CATEGORY = 'Scientist';
SELECT COUNT(*) FROM NOBEL WHERE SUBJECT = '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.
Model answer
(i) UPDATE Employee SET Department = 'IT' WHERE First_name = 'Shivam';
(ii) DELETE FROM Employee WHERE First_name = 'Alisha';
(iii) ALTER TABLE Employee ADD Experience INT;
(iv) SELECT E.First_name, E.Last_name, R.Amount FROM Employee E, Reward R WHERE E.Employee_id = R.Employee_id;
(v) SELECT E.First_name, E.Salary FROM Employee E, Reward R WHERE E.Employee_id = R.Employee_id AND R.Amount < 2000;
OR
(i) SELECT YEAR(Joining_date) FROM Employee;
(ii) SELECT Department, AVG(Salary) FROM Employee GROUP BY Department;
(iii) SELECT E.First_name, R.Date_reward FROM Employee E, Reward R WHERE E.Employee_id = R.Employee_id AND DAYNAME(E.Joining_date) = 'Monday';
(iv) SELECT SUM(E.Salary) FROM Employee E, Reward R WHERE E.Employee_id = R.Employee_id AND R.Amount > 3000;
(v) DROP TABLE Reward;
-- Queries for main task
UPDATE Employee SET Department = 'IT' WHERE First_name = 'Shivam';
DELETE FROM Employee WHERE First_name = 'Alisha';
ALTER TABLE Employee ADD Experience INT;
SELECT E.First_name, E.Last_name, R.Amount FROM Employee E, Reward R WHERE E.Employee_id = R.Employee_id;
SELECT E.First_name, E.Salary FROM Employee E, Reward R WHERE E.Employee_id = R.Employee_id AND R.Amount < 2000;
MySQL SQL Revision Tour· 2 Marks· Q26· 2025 Board Paper
What is a Database Management System (DBMS)? Mention any two examples of DBMS.
Model answer
DBMS (Database Management System) is software that manages databases. Examples: MySQL, Oracle, PostgreSQL, MongoDB.
Explanation: It provides an interface between the user and the database.
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.
/* (i) Create Table */
CREATE TABLE Customer (
CID INT PRIMARY KEY,
FName VARCHAR(20),
LName VARCHAR(20),
Age INT
);
/* (ii) Display Descending */
SELECT * FROM Customer ORDER BY LName DESC;
MySQL SQL Revision Tour· 1 Mark· Q11· 2026 Board Paper
Which of the following is the correct expanded form of DML?
(A)Device Management Language
(B)Device Manipulation Language
(C)Data Management Language
(D)Data Manipulation Language
Model answer
Data Manipulation Language
Explanation: DML stands for Data Manipulation Language, which includes commands like INSERT, UPDATE, and DELETE.
MySQL SQL Revision Tour· 2 Marks· Q24· 2026 Board Paper
Define the following terms with respect to RDBMS:
a. Domain
b. Tuple
Model answer
a. Domain: The set of all possible values that a column (attribute) can contain.
b. Tuple: A row in a table representing a complete record.
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.
Model answer
(i) SQL statement to create table PRODUCTS:
CREATE TABLE PRODUCTS (
PID INT PRIMARY KEY,
PName VARCHAR(30),
PCat CHAR(15),
Price DECIMAL(10, 2)
);
(ii) SQL query to update price:
UPDATE PRODUCTS
SET Price = Price + 100
WHERE PCat = 'Grocery';
/* (i) Create table PRODUCTS */
CREATE TABLE PRODUCTS (
PID INT PRIMARY KEY,
PName VARCHAR(30),
PCat CHAR(15),
Price DECIMAL(10, 2)
);
/* (ii) Update Price */
UPDATE PRODUCTS
SET Price = Price + 100
WHERE PCat = 'Grocery';
MySQL SQL Revision Tour· 1 Mark· Q16· 2025 Compartment Paper
The ALTER command in SQL can be used to:
(A)Alter data within a table
(B)Delete data from a table
(C)Modify the structure of a table
(D)Create a new table
Model answer
Modify the structure of a table
Explanation: ALTER TABLE is a DDL command used to add, delete, or modify columns in an existing 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.
Model answer
Assertion (A) is False, but Reason (R) is True.
Explanation: A table can only have exactly one primary key. It can have multiple candidate keys, from which one is selected as the 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.
Model answer
(a) SQL Query:
CREATE TABLE Customer (
CID DECIMAL(10,0) PRIMARY KEY,
Name VARCHAR(50),
Dob DATE,
Phone VARCHAR(15)
);
(b) SQL Query:
SELECT COUNT(*) FROM Customer;
/* (a) Table Creation */
CREATE TABLE Customer (
CID INT PRIMARY KEY,
Name VARCHAR(50),
Dob DATE,
Phone VARCHAR(15)
);
/* (b) Record Count */
SELECT COUNT(*) FROM 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';
Model answer
(a) SQL Queries:
(i) SELECT custid, cust_name, age FROM Customer WHERE age < 30;
(ii) SELECT city, MIN(age) FROM Customer GROUP BY city;
(iii) SELECT custid, cust_name, email FROM Customer WHERE city = 'Nagpur';
(iv) UPDATE Customer SET phone = '8995715156' WHERE cust_name = 'Trisha';
OR
(b) Output of SQL Queries:
(i) BALL PEN, MARKER
(ii) FOLDER
(iii) GLUE, NOTEBOOK, MARKER
(iv) 2
/* Part A Queries */
SELECT custid, cust_name, age FROM Customer WHERE age < 30;
SELECT city, MIN(age) FROM Customer GROUP BY city;
SELECT custid, cust_name, email FROM Customer WHERE city = 'Nagpur';
UPDATE Customer SET phone = '8995715156' WHERE cust_name = 'Trisha';
/* Part B Queries */
SELECT UPPER(ITEM_NAME) FROM STATIONERY WHERE CATEGORY = 'WRITING';
SELECT ITEM_NAME FROM STATIONERY WHERE MONTH(PUR_DATE) = 4;
SELECT ITEM_NAME FROM STATIONERY WHERE QTY < 50;
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.
(A)i. Date
(B)ii. Integer
(C)iii. Varchar
(D)iv. Month
Model answer
iv. Month
Explanation: MySQL supports DATE, INTEGER, and VARCHAR, but MONTH is not a valid SQL data type (it is a function).
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:
(A)Create a table
(B)Filter rows based on a specific condition
(C)Specify the columns to be displayed
(D)Sort the result based on a column
Model answer
(B) Filter rows based on a specific condition
Explanation: The WHERE clause is used to extract only those records that fulfill a specified condition.
MySQL SQL Revision Tour· 1 Mark· Q4· 2025 Sample Paper
Identify the SQL command used to delete a relation (table) from a relational database.
(A)DROP TABLE
(B)REMOVE TABLE
(C)DELETE TABLE
(D)ERASE TABLE
Model answer
(A) DROP TABLE
Explanation: DROP TABLE removes the entire table structure and its data. DELETE only removes rows.
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.
(A)Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of Assertion (A)
(B)Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A)
(C)Assertion (A) is True, but Reason (R) is False
(D)Assertion (A) is False, but Reason (R) is True
Model answer
(D) Assertion (A) is False, but Reason (R) is True
Explanation: INSERT INTO is a DML (Data Manipulation Language) command, not DDL.
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.
Model answer
Primary Key: Uniquely identifies rows, cannot be Null. Candidate Key: Any column capable of being a Primary Key.
Explanation: A table has one Primary Key but can have multiple Candidate Keys.
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
CREATE TABLE STUDENTS (
StudentID NUMERIC PRIMARY KEY,
FirstName VARCHAR(20),
LastName VARCHAR(10),
DateOfBirth DATE,
Percentage FLOAT(10,2)
);
INSERT INTO STUDENTS VALUES(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?
(A)1
(B)2
(C)3
(D)4
Model answer
4
Explanation: Candidate Keys include the Primary Key plus all Alternate Keys. 1 + 3 = 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.
(A)Both A and R are True, and R correctly explains A.
(B)Both A and R are True, but R does not correctly explain A.
(C)A is True, but R is False.
(D)A is False, but R is True.
Model answer
Both A and R are True, and R correctly explains A
Explanation: INSERT is used to manipulate data, making it a Data Manipulation Language (DML) command.
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?
(A)ALTER
(B)DROP
(C)UPDATE
(D)CREATE
Model answer
C. UPDATE
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?
(A)WHERE Commission != NULL
(B)WHERE Commission IS NOT NULL
(C)WHERE Commission <> NULL
(D)WHERE Commission NOT NULL
Model answer
B. WHERE Commission IS 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.
Model answer
True
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.
(A)Both Assertion (A) and Reason (R) are True and Reason (R) is the correct explanation for Assertion (A).
(B)Both Assertion (A) and Reason (R) are True and Reason (R) is not the correct explanation for Assertion (A).
(C)Assertion (A) is True and Reason (R) is False.
(D)Assertion (A) is False, but Reason (R) is True.
Model answer
C. Assertion (A) is True and Reason (R) is False.
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.
Model answer
(A) (i) INSERT INTO BOOK VALUES (205, 'The White Tiger', 'Aravind Adiga', 350);
(ii) UPDATE BOOK SET Price = 325 WHERE BookID = 202;
(iii) DELETE FROM BOOK WHERE Author = 'R. K. Narayan';
(iv) ALTER TABLE BOOK ADD Publisher VARCHAR(30);
(v) DROP TABLE BOOK;
OR
(B) (i) SELECT PName, ROUND(Price, 1) FROM PRODUCT;
(ii) SELECT PName FROM PRODUCT WHERE RIGHT(PName,1) = 's';
(iii) SELECT PName, Category FROM PRODUCT WHERE Price <= 500;
(iv) SELECT SUM(Qty) FROM PRODUCT;
(v) SELECT LTRIM(PName) FROM PRODUCT;
INSERT INTO BOOK VALUES (205, 'The White Tiger', 'Aravind Adiga', 350);
UPDATE BOOK SET Price = 325 WHERE BookID = 202;
DELETE FROM BOOK WHERE Author = 'R. K. Narayan';
ALTER TABLE BOOK ADD Publisher VARCHAR(30);
DROP TABLE BOOK;