Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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
Experiences
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
Build my plan
Business Question From CSV
00:00
5 left

Business Question From CSV

HardSQL · PostgreSQL

Problem

The interviewer gives you a CSV and asks you to answer a business question using whatever tools you want; how do you approach it from start to finish?

For grading, assume the CSV has been loaded into csv_sales and customer reference data is available in customer_segments. Return completed, non-null sales from Q1 2025, grouped by customer segment, with unknown customers labeled Unclassified. Include only segments with at least two qualifying sales.

Output

  1. One row per qualifying segment with segment, completed_orders, net_sales, and avg_order_value
  2. Net sales equal amount minus discount, treating a missing discount as zero
  3. Order by net_sales descending, then segment ascending

Schema

csv_sales
ColumnTypeDescription
order_idPKINTUnique sales record identifier
customer_idINTCustomer identifier from the CSV
order_dateDATEDate of the sales record
amountDECIMAL(12,2)Gross sales amount
discountDECIMAL(12,2)Discount applied to the sale
statusVARCHAR(20)Sales record status
customer_segments
ColumnTypeDescription
customer_idPKINTUnique customer identifier
segmentVARCHAR(40)Customer segment label
Tablescsv_salescustomer_segments
Interviewer

Your question is Business Question From CSV. 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.