I always thought I need groupby statement after I use any aggregated function. Like for exmaple max() in MSSQL.
But surprisingly if I have to find the second highest salary this query works:
select max(Salary)from Employee
where Salary < (select max(Salary) from Employee);
Are there any exceptions to this rule that I am not aware of?