Explain the difference between INNER JOIN, LEFT JOIN and FULL OUTER JOIN with a simple example.
What the interviewer wants to hear
- INNER JOIN returns only rows that match in both tables
- LEFT JOIN returns all rows from the left table plus matches, NULL where no match
- FULL OUTER JOIN returns all rows from both tables
- Gives a concrete example such as customers and orders
Model answer
Take a customers table and an orders table joined on customer_id. An INNER JOIN returns only customers who have at least one order, because it keeps rows that match on both sides. A LEFT JOIN from customers to orders returns every customer; for those with no orders, the order columns are NULL. This is what I use when I need "all customers with their order count, including zero". A FULL OUTER JOIN returns all rows from both tables: matched pairs, customers with no orders, and orders with no valid customer. That last one is useful for data quality checks, for example finding orphan orders. I also watch out for one-to-many joins, because joining customers to orders repeats the customer row for each order, which can inflate totals if I sum customer-level values.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Data Analyst questions
- You receive a new dataset from a client. What steps do you take to clean it before analysis?
- When would you use the median instead of the mean? Give a business example.
- How do you decide which chart to use for a piece of data?
- How would you explain a data finding to a manager who is not technical?
- Walk me through one analysis you did from start to finish.
- How do you check that the numbers from your SQL query are correct before you share them?
- What is the difference between VLOOKUP and XLOOKUP, and which do you prefer?
- What is the difference between a metric and a KPI? Give an example.
- You find duplicate customer records in a dataset. How do you handle them?