Find the names of the two highest scoring individuals in a table of data.

Write a SQL query to find the names of the two highest scoring individuals in a table of data.

Problem

Given a table of data with three columns - id, name, and score - write a SQL query to find the names of the two highest scoring individuals.
Example input:
id | name | score
1 | John | 10
2 | Jane | 9
3 | Joe | 8
4 | Jill | 7
Example output:
name
John
Jane

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by AskAI
SELECT name
FROM table
ORDER BY score DESC
LIMIT 2;

/*

The above solution is optimal because it uses the ORDER BY and LIMIT clauses to sort the table by score in descending order and then return the first two rows.

*/

A.I. Evaluation of the Solution

The candidate's solution is correct and demonstrates a good understanding of SQL.

Evaluated at: 2023-01-27 02:28:58

Community solutions:

Check these solutions from our community and artificial intelligence:
The candidate's solution is correct and demonstrates a good understanding of SQL.