How to list the highest salary among all employee functions?

3

People, I want to know how to list only the function that has the highest salary and not the highest salaries of all functions, does anyone give me a light? Here's how I'm doing:

select max(Salario) from Funcionarios group by Funcao;

I also did this:

select max(Salario) from Funcionarios;

And that's the way I want it. I want to display the highest salary among all the functions and also the name of this function that has the highest salary, but I do not know how to do it.

    
asked by anonymous 20.08.2016 / 20:01

1 answer

4

SELECT funcao from Funcionarios WHERE salario = (select max(salario) from Funcionarios);

Probably has a better solution than this, but at the moment I can not think of any: D

    
20.08.2016 / 20:43