Easy · Database
Customers Without Orders
Given Customer(id, name) and Orders(id, customerId), return the Customer name for every customer with no order. Keep distinct customer rows even if names repeat; row order does not matter.
Examples
Example 1
{
"customers": [
{"id": 1, "name": "Ada"},
{"id": 2, "name": "Ben"},
{"id": 3, "name": "Cy"}
],
"orders": [
{"id": 10, "customerId": 1}
]
}Output: [{"Customer":"Ben"},{"Customer":"Cy"}]
Example 2
{
"customers": [
{"id": 4, "name": "Dee"},
{"id": 5, "name": "Eve"}
],
"orders": [
{"id": 11, "customerId": 4},
{"id": 12, "customerId": 5}
]
}Output: []
Rebuild it in the studio
20 free core interview problems with full runner & lessons; explore the complete 380+ library with Pro.