Search
 
SCRIPT & CODE EXAMPLE
 

SQL

get max salary from each department sql

--Find out the name of top earner in each departments
--Output has Name, Department name and max salary of the department

SELECT E.FIRST_NAME , D.DEPARTMENT_NAME, E.SALARY
FROM EMPLOYEES E
JOIN DEPARTMENTS D ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
WHERE SALARY IN(SELECT MAX(E.SALARY)
FROM EMPLOYEES E
JOIN DEPARTMENTS D ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
GROUP BY DEPARTMENT_NAME);
Comment

max 3 salary in sql

SELECT salary, first_name, last_name FROM employees
ORDER BY salary DESC LIMIT 3;
Comment

how to get max salary in each department in sql

SELECT firstname, MAX(salary)
FROM department d LEFT OUTER JOIN employee e
ON (d.department_id = e.department_id)
GROUP BY department_id; 
Comment

PREVIOUS NEXT
Code Example
Sql :: create temp table in sql 
Sql :: calculate percentage in sql 
Sql :: sql server drop column 
Sql :: mysql auerries to find the name starting with vowel letter 
Sql :: sql query rename table 
Sql :: sql server remove primary key without dropping table 
Sql :: sql select lowest value row 
Sql :: tinydb add table 
Sql :: oracle all_dependencies 
Sql :: how to view created temporary tables in mysql 
Sql :: intellij mysql set timezone 
Sql :: select random rows sql 
Sql :: duplicate key value violates unique constraint in postgresql 
Sql :: install latest mysql 8 linux server 
Sql :: sql datitime to date 
Sql :: uppercase sql 
Sql :: mariadb cast to int 
Sql :: all tables and views oracle 
Sql :: what is having clause in sql 
Sql :: how to get connect string from mysql database 
Sql :: oracle dynamic select into 
Sql :: select last n rows mysql 
Sql :: stuff sql server 
Sql :: json_value oracle 
Sql :: postgresql concat string with separator 
Sql :: Assign value to variable inside Dynamic SQL 
Sql :: sql search all tables for attributes 
Sql :: Access PostgreSQL PSQl with sudo 
Sql :: sql compiler online 
Sql :: oracle sql unique 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =