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 :: php5-mysql has no installation candidate 
Sql :: mysql insert rows to another database 
Sql :: flask connect to mysql 
Sql :: mysql select row with max value group by 
Sql :: decimal() mysql 
Sql :: Add a new column into table 
Sql :: how to open mysql in docker 
Sql :: how to delete user sql server 
Sql :: mysql unique constraint 
Sql :: alter table query in mysql 
Sql :: export database sql file from xampp using cmd 
Sql :: SQL Server run query on linked server 
Sql :: SQL Query to delete all the tables in a database 
Sql :: mysql filter by date mount 
Sql :: create postgres table 
Sql :: how to check default value of column in sql server 
Sql :: get size of mysql database 
Sql :: UNION ALL LEFT JOIN 
Sql :: connect by query in oracle 
Sql :: SQL AVG() Function 
Sql :: disable module odoo 
Sql :: querry mysql by 2 columns 
Sql :: exclude last comma separated string mysql 
Sql :: sql contains vs like 
Sql :: excel vba import data to sql server 
Sql :: convert sql server guid to varbinary 
Sql :: drop databse 
Sql :: sql length 
Sql :: difference between left outer join and left join in sql 
Sql :: drop a field in psql django 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =