Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Compare Seller Performance Before and After Onboarding

MediumSQL · PostgreSQL00:00
I
Practice interviewer
In session
5 left
00:00

Your question is Compare Seller Performance Before and After Onboarding. 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

You are given seller onboarding records and order activity. Write a PostgreSQL query that compares each seller’s performance before and after their onboarding change date, and returns the change in average order value and order count across the two periods.

Use the seller’s onboarding change date as the cutoff: orders on or after that date belong to the after period, and orders before it belong to the before period. Return only sellers who have at least one order in both periods.

Schema

seller_onboarding
ColumnTypeDescription
seller_idPKINTUnique seller identifier
seller_nameVARCHAR(255)Seller display name
onboarding_change_dateDATEDate the onboarding change started for the seller
orders
ColumnTypeDescription
order_idPKINTUnique order identifier
seller_idINTSeller who placed the order
order_dateDATEDate the order was placed
order_amountDECIMAL(10,2)Gross value of the order
Tablesseller_onboardingorders
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results