Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Explain SQL Joins

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Explain SQL Joins. Start with the requirements and the two tables on the right.

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.

Problem

Explain what SQL is and how joins work.

For the hands-on portion, write a query that returns every customer with their order count and total order value, including customers who have no orders.

Output

  1. One row per customer with customer_id, customer_name, order_count, and total_order_value
  2. Include customers without matching orders with zero totals
  3. Sort by customer_id ascending

Schema

customers
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(100)Customer display name
orders
ColumnTypeDescription
order_idPKINTUnique order identifier
customer_idINTCustomer associated with the order
order_totalNUMERIC(10,2)Total value of the order
Tablescustomersorders
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results