Find the customer with the highest total purchase amount

To find the customer with the highest total purchase amount, write a SQL query that select the customer with the maximum TotalPurchaseAmount from the table.

Problem

Given a table of data with customer information, write a SQL query to find the customer with the highest total purchase amount.
Example input:
CustomerID | Name | TotalPurchaseAmount
1 | John | 100
2 | Doe | 200
3 | Smith | 300
Example output:
3 | Smith | 300

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT CustomerID, Name, TotalPurchaseAmount
FROM Customer
ORDER BY TotalPurchaseAmount DESC
LIMIT 1;

/*

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

*/

A.I. Evaluation of the Solution

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

Evaluated at: 2022-11-10 20:15:12