Software Engineering Intern Interview Question

What is a SQL join, and how would you find customers who have never placed an order?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

A join combines rows from two tables using a related column, such as a customer id. An inner join returns only rows with a match in both tables, while a left join returns every row from the left table plus any matches from the right, with nulls where there are none. To find customers with no orders, left join customers to orders on the customer id and keep rows where the order id is null, or use NOT EXISTS.

Why interviewers ask this

Almost every internship touches a database, and joins are the core skill interviewers check. They want to see that you know the difference between inner and left joins and can apply it to a real question. The never placed an order example specifically tests whether you understand that missing matches show up as nulls, which is the step many students get wrong, and whether you know an alternative such as NOT EXISTS.

How to structure your answer

  • Explain what a join does with a simple example.
  • Compare inner and left joins.
  • Write the query for customers with no orders.
  • Mention an alternative and a common mistake.

Example answer

Spoken example, first person

A join combines rows from two tables using a column they share. With a customers table and an orders table, each order has a customer id, so joining on that column shows each order alongside the customer's name. An inner join only returns rows with a match on both sides, so customers with no orders simply do not appear. A left join keeps every row from the left table, here customers, and fills in the order columns where there is a match, leaving them null where there is not. That null is exactly what I need. So I would select from customers, left join orders on the customer id, and add a where clause keeping only rows where the order id is null. Those are the customers with no matching order. Another way is NOT EXISTS with a subquery that looks for an order for each customer, which some people find clearer. The mistake I made when learning this was putting the null check in the join condition instead of the where clause, which returns every customer and filters nothing. A tiny test dataset showed me the difference.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What is the difference between WHERE and HAVING?
  • How would you find each customer's total spend?
  • When would you use NOT EXISTS instead of NOT IN?

Related software engineering intern questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot