Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Left Join vs Inner Join
00:00
5 left

Left Join vs Inner Join

EasySQL · PostgreSQL

Problem

Explain the difference between a left join and an inner join in SQL.

Use the Firstnet Global customer and order data to demonstrate the difference with query results. Show all customers and indicate whether an order match exists.

Output

  1. One row per Firstnet Global customer and matching order, including customers without orders.
  2. Columns: customer_id, customer_name, order_id, and match_status.
  3. Sort by customer_id, then order_id, with unmatched customers shown clearly.

Schema

customers
ColumnTypeDescription
customer_idPKINTUnique Firstnet Global customer identifier
customer_nameVARCHAR(100)Customer display name
orders
ColumnTypeDescription
order_idPKINTUnique order identifier
customer_idINTCustomer associated with the order
order_statusVARCHAR(30)Current order status
Tablescustomersorders
Interviewer

Your question is Left Join vs Inner Join. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.