Knowee
Questions
Features
Study Tools

Write SQL QueriesEmployee TableDepartment Table1. Get the list of employees whose salary is more than 20K and are in HR department.2. Get the salary being paid to each Department.3. Get the employees with the third highest salary.4. Name and designation of the employees who don't have any manager

Question

Write SQL QueriesEmployee TableDepartment Table1. Get the list of employees whose salary is more than 20K and are in HR department.2. Get the salary being paid to each Department.3. Get the employees with the third highest salary.4. Name and designation of the employees who don't have any manager

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here are the step-by-step SQL queries to answer the given questions:

  1. Get the list of employees whose salary is more than 20K and are in HR department:

SELECT * FROM Employee WHERE salary > 20000 AND department = 'HR';

  1. Get the salary being paid to each Department:

SELECT department, SUM(salary) AS total_salary FROM Employee GROUP BY department;

  1. Get the employees with the third highest salary:

SELECT * FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2;

  1. Name and designation of the employees who don't have any manager:

SELECT name, designation FROM Employee WHERE manager_id IS NULL;

Please note that these queries assume the existence of the Employee and Department tables with appropriate columns. Adjust the table and column names accordingly if needed.

This problem has been solved

Similar Questions

Find the following table EmployeeDetails, with the attributes EmployeeID, EmpName, Designation, Salary, DeptNo. You are assigned to a task of providing the solution to the operations department by writing the query which displays the employeeID and the Designation of all the employees whose Salaries are more than the Salary of employees designated as ManagerC

Write a query to display the ename of employees working in 'HR' department and who draw an annual salary greater than 1000000. [Consider employees who work in multiple departments too]. Display the records sorted in ascending order based on employee ename.Note:1. Display all the ename of employees working in 'HR' department and having annual salary greater than 1000000.2. Use Joins. Tables involved are employee, works and department3. Order by is mandatory.

Write an SQL query to find the employees who earn more than their managers.

Write a SQL query considering below schema. Create tables with Primary Key, foreign key constraints in given schemas.Manager (mid, eid, mname)Department (did, mid, dname, location)Employee (eid, ename, mobile, salary, joining_date, mid)i.Give the name and salary of employees whose salary are greater than each and every employees who are working under managerid 14.ii.Give the name of employees who have not assigned any department.iii.Give the employee names whose location is Kota.iv.Give the name of manager along with count of employees assigned to him/her in descending order

The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.IdNameSalaryManagerId1Joe7000032Henry8000043Sam60000NULL4Max90000NULLGiven the Employee table, write a SQL query that finds out employees who earn more than their managers. For the above table, Joe is the only employee who earns more than his manager.EmployeeJoeOptionsselect e.Name as Employee to Employeefrom e inner join Employee has m on e.ManagerId = m.id where e.Salary > m.Salary;select e.Name as Employee from Employeeas e inner join Employee as m on e.ManagerId = m.idwhere e.Salary > m.Salary;select e.Name as Employeefrom Employee on e.ManagerId = m.id where e.Salary > m.Salary;select e.Name as Employee from Employeeas e inner join Employee

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.