SQL query to return customers who have placed orders over $100

This technical problem involves writing a SQL query that returns the names of customers who have placed orders with a total value of more than $100.

Problem

Write a SQL query that returns the names of all customers who have placed an order with a total value of more than $100.
Example input:
Table: orders
id | customer_id | order_date | total_value
1 | 1 | 2019-01-01 | 50
2 | 1 | 2019-02-01 | 75
3 | 2 | 2019-03-01 | 125
4 | 3 | 2019-04-01 | 25
Example output:
customer_id | name
1 | John Smith
2 | Jane Doe
3 | NULL

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT customer_id, name
FROM orders
JOIN customers
ON orders.customer_id = customers.id
WHERE total_value > 100;

/*

The solution above is optimal because it uses a JOIN to combine the orders and customers tables. This allows us to access the name column from the customers table.

*/

A.I. Evaluation of the Solution

The solution above is optimal because it uses a JOIN to combine the orders and customers tables. This allows us to access the name column from the customers table.

Evaluated at: 2022-11-06 03:15:53