Find the most popular articles on a website.

Write a SQL query to find the most popular articles on a website. The table "articles" contains the id, title, and views for each article. The query should return the id, title, and views for the most popular article.

Problem

Write a SQL query to find the most popular articles on a website.
Example input:
Table: articles
id | title | views
1 | Article 1 | 100
2 | Article 2 | 200
3 | Article 3 | 300
Example output:
id | title | views
3 | Article 3 | 300

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT id, title, views
FROM articles
ORDER BY views DESC
LIMIT 1;

/*

The solution above is optimal because it uses the ORDER BY and LIMIT clauses to sort the articles by views in descending order and then limit the results to the first row.

*/

A.I. Evaluation of the Solution

The solution above is optimal because it uses the ORDER BY and LIMIT clauses to sort the articles by views in descending order and then limit the results to the first row.

Evaluated at: 2022-11-13 10:15:35