Given a table of data with employee IDs, names, and salaries, write a SQL query to find the highest paid employee.
Given a table of data with employee IDs, names, and salaries, write a SQL query to find the highest paid employee. Example input: +----+----------+--------+ | ID | Name | Salary | +----+----------+--------+ | 1 | John Doe | 100000 | | 2 | Jane Doe | 120000 | | 3 | Joe Smith| 80000 | +----+----------+--------+ Example output: +----+----------+--------+ | ID | Name | Salary | +----+----------+--------+ | 2 | Jane Doe | 120000 | +----+----------+--------+
SELECT * FROM table ORDER BY Salary DESC LIMIT 1; /* The solution above is optimal because it uses the ORDER BY and LIMIT clauses to sort the table by salary in descending order and then return the first row. */
The candidate's solution is correct and demonstrates a good understanding of SQL.
Evaluated at: 2022-11-20 02:16:23