we have following relations:employees(employee_id,first_name,last_name,email,salary,department_id)departments(department_id,department_name,location_id)(1) Find the employees who have the highest salary.(2) Display all the employee name along with department name who are working neitherin ‘HR’ Department nor earns more than 50000.2
Question
we have following relations:employees(employee_id,first_name,last_name,email,salary,department_id)departments(department_id,department_name,location_id)(1) Find the employees who have the highest salary.(2) Display all the employee name along with department name who are working neitherin ‘HR’ Department nor earns more than 50000.2
Solution
This seems like a SQL related question. Here are the queries for your questions:
(1) To find the employees who have the highest salary, you can use the following SQL query:
SELECT *
FROM employees
WHERE salary = (SELECT MAX(salary) FROM employees);
This query first finds the maximum salary from the employees table and then selects the employees who have this maximum salary.
(2) To display all the employee names along with department names who are working neither in ‘HR’ Department nor earns more than 50000, you can use the following SQL query:
SELECT e.first_name, e.last_name, d.department_name
FROM employees e
JOIN departments d ON e.department_id = d.department_id
WHERE d.department_name != 'HR' AND e.salary <= 50000;
This query joins the employees and departments tables on the department_id, and then selects the employees who are not in the HR department and who earn 50000 or less.
Similar Questions
we have following relations:employees(emp_id,name,dept_id)salaries (emp_id,salary)1) Find out the names of employees who belong to the same department as Mark andsalary greater than 50,000.2) Find out names of employees whose salaries are greater than 50,000.3) Retrieve the names of employees who have higher salary then John
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
Write a query to find employees who have the highest salary in each of the departments.Input format :The input tables are already prepopulated, as given in the problem statement.Output format :The output display the name of each department along with the name of the employee who has the highest salary within that department and their respective salary. Order the output by department name as shown below.Refer to the sample output for the column headers.
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.
We have following relationEMP(empo,ename,jobtitle,manager_no,hiredate,salary,deptno)DEPT (deptno, dname,location)1) Find employees whose name start with letter A or letter a.2) Find the employees who are working in smith's department.3) Display employees who are getting maximum salary in each department
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.