Turning Learners Into Developers
Codekilla
CODEKILLA
Easy
SQL-J01sql

Customers Who Placed Orders

Problem

Given `customers(id, name)` and `orders(id, customer_id, amount)`, return the **distinct names** of customers who placed at least one order, sorted alphabetically.

Input
Two tables: customers and orders.
Output
name (string)
Constraints
1 ≤ rows ≤ 10^5
Sample input
customers: (1,'Ada'), (2,'Linus'), (3,'Grace')
orders: (10,1,99),(11,1,49),(12,3,12)
Sample output
Ada
Grace
Explanation
Ada and Grace each have ≥1 order; Linus does not.
joinsinner-joindistinct@Amazon@Google
Visible test cases
in: see prompt
out: Ada
Grace
Your solution — run it, use AI if stuck
sql