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
Question
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
Solution
Sure, here is the SQL query that you need:
SELECT EmployeeID, Designation
FROM EmployeeDetails
WHERE Salary > (SELECT Salary FROM EmployeeDetails WHERE Designation = 'ManagerC');
This query works in the following way:
- The subquery
(SELECT Salary FROM EmployeeDetails WHERE Designation = 'ManagerC')returns the salary of the employees who have the designation 'ManagerC'. - The main query then selects the
EmployeeIDandDesignationfrom theEmployeeDetailstable where theSalaryis greater than the salary of 'ManagerC' returned by the subquery.
Please note that this query assumes that all 'ManagerC' have the same salary. If they have different salaries, you might want to use MAX or MIN functions depending on whether you want to compare with the highest or lowest salary of 'ManagerC'.
Similar Questions
Write queries for the following tables:T1 ( Empno, Ename , Salary, Designation)T2 (Empno, Deptno.)(1) Display the Deptno in which Employee Seeta is working.(2) Display Empno, Ename, Deptno.
Consider the following EmployeeDetails table.You want to display the details of employees whose salary is more than the lowest salary of department having ID 10.To perform this task, which of the following query you can use the
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
we have following relationsEMP(empno, ename, jobtitle, manager, hiredate, salary, deptno)DEPT(deptno, dname,location)Answer the following queries .1) Find the Employees who get salary more than Chris salary.2) Display department number along with the number of employees which belongs to thatdepartment number
For given relation:Employee(eid, ename, address,deptname ,salary)Project(eid, pid, pname, location)(1) Display name and salary of employee who is taking maximum salary.(2) Display highest salary department wise and name of employee who is taking thatsalary.(3) Find details of employee who works on a pid equal to 10
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.