BASIC SELECT (FOUNDATION)
1. Display all employees in descending order of salary.
2. Display all employees who belong to Mumbai city.
(Assume city is stored inside department or via mapping — students must clarify)
3. Find all employees whose salary is more than the average salary.
4. Display the total sum of salary of all employees.
5. Display all unique employee addresses.
(If address column is not available, students must modify table)
6. Display a column called details that shows:
name + address concatenated, along with salary.
INTERMEDIATE AGGREGATION & FILTERING
7. Display the name(s) of employee(s) having the maximum salary.
8. Find the employee(s) having the second highest salary.
9. Display the count of employees by address, ordered by employee count.
10. Show the total number of employees from Nagpur only.
11. Display employees whose names start OR end with a vowel (a,e,i,o,u).
12. Find the employee(s) having maximum salary in each city.
13. Display the top 5 highest salaried employees.
14. Display the second highest salaried employee using a subquery.
15. Show the list of cities where total salary is more than 200000.
JOINS BASED ASSIGNMENTS (STUDENT SYSTEM)
16. Display all students who have appeared for the exam.
(Students who exist in result table)
17. Display:
Student Name, Subject (Department Name), and Marks
Using:
- students
- departments
- result
18. Display Student Name and Total Marks only for students whose
total marks are greater than 80.
TRIGGERS & EVENTS (ADVANCED)
19. (Trigger Assignment)
Create a trigger such that:
Whenever an employee is deleted, their data is automatically inserted into
deleted_employeestable.
20. (Event Scheduler Assignment)
Create a MySQL event that:
Automatically deletes audit logs older than 5 minutes, and
Runs every 2 minutes.
CHALLENGE
- Find employees who do not have a manager
- Find departments having more than 5 employees
- Show manager name with employee name (self join)
TABLES
🔹 employee
id, name, department, manager_id, salary, created_at, updated_at
🔹 students
id, name
🔹 department
id, name
🔹 result
id, student_id, department_id, marks
🔹 auditlog
id, username, activity, created_at