Top 3 Most Populous Countries

The technical problem is how to write a SQL query that returns the top 3 most populous countries. The example output is China, India, United States.

Problem

Write a SQL query that returns the top 3 most populous countries.
Example input:
N/A
Example output:
China, India, United States

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT name, population
FROM world
ORDER BY population DESC
LIMIT 3;

/*

The solution is optimal because it uses the ORDER BY and LIMIT clauses to sort the table by population in descending order and then limit the results to the top 3.

*/

A.I. Evaluation of the Solution

The solution is optimal because it uses the ORDER BY and LIMIT clauses to sort the table by population in descending order and then limit the results to the top 3.

Evaluated at: 2023-01-28 02:15:26