Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Query for Seller Orders

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

Your question is SQL Query for Seller Orders. 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

Deliverr needs a seller-level order count for operational reporting. Write a PostgreSQL query that returns every seller and the number of orders associated with that seller in Deliverr.

Requirements

  1. Include sellers who have not placed any orders, showing an order count of 0.
  2. Count each matching order once using the order's primary key.
  3. Return one row per seller, ordered by seller_id ascending.

Schema

sellers
ColumnTypeDescription
seller_idPKINTEGERUnique seller identifier
seller_nameVARCHAR(150)Seller display name
orders
ColumnTypeDescription
order_idPKBIGINTUnique Deliverr order identifier
seller_idINTEGERSeller associated with the order
order_dateDATEDate the order was created
Tablessellersorders
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results