SQL query to find customers who have placed an order with a value greater...

This technical problem involves writing a SQL query to find customers who have placed an order with a value greater than $100. The example input provides sample data for a customers table and an orders table . The expected output is a list of customer ids and names who have placed an order with a value greater than $100.

Problem

Given two tables, "customers" and "orders", write a SQL query to find the customers who have placed an order with a value greater than $100.
Example input:
customers:
id 	name
1 	John
2 	Smith
3 	Jane
4 	Joe
orders:
id 	customer_id 	amount
1 	1 			50
2 	2 			75
3 	3 			120
4 	4 			25
Example output:
id 	name
3 	Jane

Solution

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

/*

The solution above is optimal because it uses a JOIN to combine the two tables and then filters the results to only include customers who have placed an order with a value greater than $100.

*/

A.I. Evaluation of the Solution

The solution above is optimal because it uses a JOIN to combine the two tables and then filters the results to only include customers who have placed an order with a value greater than $100.

Evaluated at: 2022-11-07 08:15:27