You are on page 1of 1

Question 1: SQL Query to find third highest salary of Employee.

ans : select min(salary) from emp where emp in (select salary from emp order by
desc limit 3)

Question 2: SQL Query to get date wise number of joinee�s.


ans: select date_joining, count(id) from emp group by date_joining

Question 3: find all Employee records whose First name containing the character "o"
or �e�, regardless of whether it is in the middle, start or end positions.
ans: select first_name from emp where first_name like '%o%' union select first_name
from emp where first_name like '%e%

Question 4: Write SQL Query to find department wise total salary while calculating
consider the persons whose salary is greater than average salary.
ans:

Question 5: How do you find all employees whose first name or last name should
contain �ha� and who are also managers.
ans: select * from emp where first_name like '%ha%' or last_name like '%ha%' and
manager_id =department_id;

Question 6:SQL Query to find Max Salary from each department.


ans:select max(salary) from emp group by dept_name and dept_it in (select
a.salary, b.dept_name from emp a join dept b on a.department_id=b.dept_id)

Question 7: Write query to update salary as 500000 whose Last name contain 'e' and
whose department is Services or Insurance.
ans:

Question 8: Write to query to rename the Department_id as dept_id in first tabl


ans: alter table emp rename column department_id to dept_id.

You might also like