Question bank

Class 12

1 subject · 351 questions

Refine

All questions

351 results
61

Write an SQL query to retrieve names of teachers having at least 6 characters in the first name.

SHORT Hard
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT First_Name FROM Teacher WHERE First_Name LIKE '______%';
62

Write an SQL query to list names of teachers in alphabetical order (by First_Name then Last_Name).

SHORT Easy
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT First_Name, Last_Name FROM Teacher ORDER BY First_Name, Last_Name;
63

Write an SQL query to list department names in descending alphabetical order.

SHORT Easy
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT Dept_Name FROM Department ORDER BY Dept_Name DESC;
64

Write an SQL query to retrieve details of teachers whose Last_Name is NOT specified (NULL).

SHORT Easy
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT * FROM Teacher WHERE Last_Name IS NULL;
65

Write a nested SQL query to retrieve the names of all departments having female teachers.

SHORT Hard
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT DISTINCT Dept_Name FROM Department WHERE Dept_ID IN (SELECT Dept_No FROM Teacher WHERE Gender = 'F');
66

Write an SQL query to find the total salary of all teachers.

SHORT Easy
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT SUM(Salary) AS Total_Salary FROM Teacher;
67

Write an SQL query to find the maximum and minimum salary among all teachers.

SHORT Easy
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT MAX(Salary) AS Max_Salary, MIN(Salary) AS Min_Salary FROM Teacher;
68

Write an SQL query to count the number of teachers earning more than Rs 40000.

SHORT Easy
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT COUNT(*) FROM Teacher WHERE Salary > 40000;
69

Write an SQL query to display teacher names, current salary, and a 10 percent increased salary (as New_Salary) for teachers in department 4.

SHORT Medium
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT First_Name, Last_Name, Salary, Salary*1.1 AS New_Salary FROM Teacher WHERE Dept_No = 4;
70

Write an SQL query using GROUP BY to find the number of teachers in each department (Dept_No).

SHORT Medium
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT Dept_No, COUNT(*) AS No_of_Teachers FROM Teacher GROUP BY Dept_No;
71

Write an SQL query using GROUP BY and JOIN to find the number of teachers per department, showing department names.

SHORT Medium
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT Dept_No, Dept_Name, COUNT(*) AS No_of_Teachers FROM Teacher, Department WHERE Dept_ID = Dept_No GROUP BY Dept_No;
72

Write an SQL query using GROUP BY and HAVING to find departments having more than one teacher.

SHORT Hard
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: SELECT Dept_No, Dept_Name, COUNT(*) AS No_of_Teachers FROM Teacher, Department WHERE Dept_No = Dept_ID GROUP BY Dept_No HAVING COUNT(*) > 1;
73

Write an SQL query to update the salary of teacher with Teacher_ID = 101 to 55000.

SHORT Easy
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: UPDATE Teacher SET Salary = 55000 WHERE Teacher_ID = 101;
74

Write an SQL query to increase the salary of teacher named 'Shanaya' by 5000.

SHORT Medium
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: UPDATE Teacher SET Salary = Salary + 5000 WHERE Teacher_Name = 'Shanaya';
75

Write an SQL query to delete the tuple for teacher with Teacher_ID = 101.

SHORT Easy
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: DELETE FROM Teacher WHERE Teacher_ID = 101;
76

Consider the Employee table (Employee_ID [PK], Employee_Name, Job_Title, Salary, Bonus, Age, Manager_ID [FK referencing Employee_ID]): Write SQL commands to (a) create the table (b) delete the employee with Employee_ID 1217 (c) update the salary of 'Amyra' to 40000.

LONG Hard
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: (a) CREATE TABLE Employee (Employee_ID INTEGER PRIMARY KEY, Employee_Name VARCHAR(20), Job_Title VARCHAR(20), Salary DECIMAL(10,2), Bonus DECIMAL(10,2), Age INTEGER, Manager_ID INTEGER, FOREIGN KEY (Manager_ID) REFERENCES Employee(Employee_ID)); (b) DELETE FROM Employee WHERE Employee_ID = 1217; (c) UPDATE Employee SET Salary = 40000 WHERE Employee_Name = 'Amyra';
77

For the same Employee table, write SQL queries to: (a) display names and salaries of employees whose salary is greater than 20000 (b) display details of employees who are not getting any bonus (c) display names of employees whose name ends with the letter 'a' (d) display name and job title of employees whose Manager_ID is 1201.

LONG Hard
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: (a) SELECT Employee_Name, Salary FROM Employee WHERE Salary > 20000; (b) SELECT * FROM Employee WHERE Bonus IS NULL; (c) SELECT Employee_Name FROM Employee WHERE Employee_Name LIKE '%a'; (d) SELECT Employee_Name, Job_Title FROM Employee WHERE Manager_ID = 1201;
78

For the same Employee table, write SQL queries to: (a) display name and job title of employees whose manager is 'Amyra' (using a self-join/nested query) (b) display name and job title of employees aged between 26 and 30 years (both inclusive).

LONG Hard
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: (a) SELECT Employee_Name, Job_Title FROM Employee WHERE Manager_ID = (SELECT Employee_ID FROM Employee WHERE Employee_Name = 'Amyra'); (b) SELECT Employee_Name, Job_Title FROM Employee WHERE Age BETWEEN 26 AND 30;
79

A Railway company has tables Machine(Machine_ID [PK, CHAR(3)], Station [CHAR(30)]) and Sales(Machine_ID [CHAR(3)], Date, Tickets_Sold [INTEGER], Income [DECIMAL(8,2)]), with Machine_ID+Date as the key of Sales. Write SQL queries to: (a) find the number of ticket machines in each station (b) find the total ticket income of station 'New Delhi' for each day (c) find the total tickets sold by machine with Machine_ID = 122 till date.

LONG Hard
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: (a) SELECT Station, COUNT(*) FROM Machine GROUP BY Station; (b) SELECT Date, SUM(Income) FROM Sales, Machine WHERE Sales.Machine_ID = Machine.Machine_ID AND Station = 'New Delhi' GROUP BY Date; (c) SELECT SUM(Tickets_Sold) FROM Sales WHERE Machine_ID = '122';
80

An application accessed via a web browser over a network connection is called a:

MCQ Easy
a. Desktop application
b. Web-based application
c. Firmware application
d. Standalone application
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Web-based application
Explanation: A web-based application is one that can be accessed via a web browser over a network connection, offering 24x7 availability.