20 karma · joined May 28, 2013
Why doesn't anyone talk about "misery prevention" ?
Also claiming that they have an incentive to leave the country seems wrong, because the requirements to acquire citizenship are so easy. You just have to prove that you understand the Latvian language at a very basic level. If you can do that, then you get citizenship. Much easier than moving to a different country.
* "em.departmentId" will contain one of the distinct values from the "departmentId" column
* "salary" will contain the maximum value of the "salary" column of the table rows whose "departmentId" equals "em.departmentId" of the given result set row.
* "em.EmployeeID" will contain the value of the "EmployeeID" column of one the table rows, whose "departmentID" equals "em.departmentId" of the given result set row, but it is UNDEFINED which one. It IS NOT quaranteed to be the one whose "salary" column equals "MAX(salary)".
See here for examples of how to achieve what is actually needed: http://dev.mysql.com/doc/refman/5.0/en/example-maximum-colum...
As I said, tricky, and, judging from the difficulty level of the other questions, I suspect that the authors of the article have fallen for it themselves.
The obvious answer - something like
select Name, MAX(Salary) from Employees group by DepartmentId
is wrong.