Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Customers with more than two orders

SQL data engineering interview problem. Difficulty: intermediate. Pattern: Joins. About 12 minutes. Part of the Pro drill bank.

Find customers with more than 2 rows in lb_orders. Return customer_id, name, order_count. Order by order_count descending, then customer_id.

Constraints

  • Count order rows, not distinct products.

Examples

Input: customers customer_id | name C01 | Ana C02 | Ben C03 | Cam lb_orders (order counts) customer_id | order_count C01 | 3 C02 | 1 C03 | 2 Output: customer_id | name | order_count C01 | Ana | 3 Why this passes: Only customers clearing the > 2 threshold appear.

Topics: lakebench, sql, having, join.

More SQL interview questions · All interview problems · Learn data engineering

intermediate

Customers with more than two orders

Interview-style drill: Customers who placed more than two orders.

Find customers with more than 2 rows in `lb_orders`. Return `customer_id`, `name`, `order_count`. Order by `order_count` descending, then `customer_id`.