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
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
SQL: Accounts Receivable Turnover
00:00
5 left

SQL: Accounts Receivable Turnover

MediumSQL · PostgreSQL

Problem

Huron Consulting Group needs a client-level financial reporting query for its consulting engagements. Calculate each client's 2024 accounts receivable turnover, defined as posted net credit sales divided by average beginning and ending accounts receivable.

Requirements

  1. Include every client, including clients without 2024 invoices or complete balance records.
  2. Count only invoices dated in 2024 with status = 'posted' as net credit sales.
  3. Calculate average accounts receivable from the January 1 and December 31 balances. Return NULL when either balance is missing or the average balance is zero.
  4. Round turnover to two decimal places and order clients by turnover descending, with null values last.

Schema

clients
ColumnTypeDescription
client_idPKINTEGERUnique client identifier
client_nameVARCHAR(120)Client organization name
invoices
ColumnTypeDescription
invoice_idPKINTEGERUnique invoice identifier
client_idINTEGERClient associated with the invoice
invoice_dateDATEInvoice issue date
statusVARCHAR(20)Invoice processing status
net_amountNUMERIC(14,2)Net invoice amount
ar_balances
ColumnTypeDescription
balance_idPKINTEGERUnique balance snapshot identifier
client_idINTEGERClient associated with the balance
as_of_dateDATEDate of the balance snapshot
ending_balanceNUMERIC(14,2)Accounts receivable balance at the snapshot date
Tablesclientsinvoicesar_balances
Interviewer

Your question is SQL: Accounts Receivable Turnover. 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.