SQL Join Query Writing
viaGlassdoor
Q: Write a SQL query involving a JOIN operation.
A: A typical prompt: given an orders table and a customers table, write a query to list each customer's name alongside their total number of orders (or similar). Demonstrate INNER JOIN for matching rows only, LEFT JOIN when you need customers with zero orders included, GROUP BY the customer's identifying column(s) with an aggregate (COUNT/SUM), and be ready to explain how NULLs from a LEFT JOIN interact with aggregate functions (e.g., COUNT(order_id) correctly returns 0 for customers with no matching orders, while COUNT(*) would incorrectly count 1).
asked …