Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Flag Sellers With High Return Rates
00:00
5 left

Flag Sellers With High Return Rates

MediumSQL · PostgreSQL

Problem

You are given order, return, and seller data. Write a PostgreSQL query that finds sellers with unusually high return rates over the last quarter, where return rate is the number of returned orders divided by total completed orders in that quarter. Return each seller’s ID, seller name, total orders, returned orders, and return rate, and only include sellers whose return rate is above 20%.

Schema

sellers
ColumnTypeDescription
seller_idPKINTPrimary key for each seller
seller_nameVARCHAR(255)Seller display name
orders
ColumnTypeDescription
order_idPKINTPrimary key for each order
seller_idINTSeller who fulfilled the order
order_dateDATEOrder completion date
order_statusVARCHAR(50)Order status such as completed or canceled
returns
ColumnTypeDescription
return_idPKINTPrimary key for each return
order_idINTOrder that was returned
return_dateDATEDate the return was created
Tablessellersordersreturns
Interviewer

Your question is Flag Sellers With High Return Rates. Start with the requirements and the three 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.