SQLSQL
#19

Multi-Table 3-Way Joins for Business Analytics in SQL

Medium
Interview Question #19

Given `users`, `orders`, and `order_items`, write a SQL query to return `user_name`, `product_category`, and total spend for that category. Only include completed orders.

Input Table: users, orders, order_items
2 rows preview
user_idorder_iditem_idcategoryprice
1101501Electronics12000
1102502Books800
Expected Output Structure2 rows
user_nameproduct_categorycategory_spend
AaravElectronics12000
AaravBooks800
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us