Data AnalyticsAnalyst career preparation and interviews

Prepare for a SQL take-home without overengineering it

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 3 min read
Technically reviewed by Ishaan Sharma
In this article (6 sections)

For a SQL take-home, first answer the stated business question correctly and make the result reproducible. Add a short explanation of grain, eligibility, assumptions and checks. Extra infrastructure is useful only when it serves a requirement of the exercise.

The practice task below is hypothetical. For a real assessment, follow its instructions on collaboration, AI assistance, confidentiality and submission format. Do not assume every employer permits the same tools or expects the same level of packaging.

Read the question as a contract

Practice brief: “Using the supplied orders, report January 2026 completed-order count and amount. Include orders with unmatched customers. Use the supplied total once per order and keep amounts in paise.”

Before writing SQL, note the source grain, status filter, inclusive start, exclusive end and amount unit. The phrase “include unmatched customers” tells you that a customer join is unnecessary for this result and must not remove eligible orders.

If the real brief says only “revenue,” identify the ambiguity. Ask a concise clarification when possible; otherwise state the interpretation used and its limitation in the submission.

Write the smallest complete query

sql
SELECT COUNT(*) AS completed_orders,
       SUM(order_total_paise) AS completed_order_amount_paise
FROM orders
WHERE status = 'completed'
  AND ordered_at >= '2026-01-01T00:00:00'
  AND ordered_at < '2026-02-01T00:00:00';

The synthetic fixture returns eight orders and 104,000 paise. No item join, customer join or window function is required. Adding them merely to display syntax knowledge would create more behavior to justify.

The commerce lab supplies the dataset and database setup. Its timestamps are interpreted as local Asia/Kolkata values for this exercise. A production source with mixed timezone representations would require an explicit normalization policy.

Add checks that challenge the answer

python
from calculator import calculate
from readonly_sql import query

reference = calculate()
result = query('SELECT COUNT(*),SUM(order_total_paise) FROM orders '
               'WHERE status=? AND ordered_at>=? AND ordered_at<?',
               ('completed','2026-01-01T00:00:00','2026-02-01T00:00:00'))
assert result['rows']==[[8,104000]]
assert reference['evidence_order_ids']==[
    'O1001','O1002','O1003','O1005','O1006','O1007','O1008','O1009']
assert reference['value']==result['rows'][0][1]
print({'query_matches_reference':True,'eligible_orders':8,'amount_paise':104000})

Also inspect uniqueness of the order key and the record exactly at the exclusive period end. Explain why duplicate amounts on different orders are valid. These checks address likely failures in this question rather than adding unrelated test cases.

Package for another person to run

Provide a SQL file, a short README, source assumptions and expected output. State the database dialect and setup command. If you use supplied confidential data, keep it within the assessment's permitted sharing arrangements; a public repository is not automatically appropriate.

Include a short note on what you did not establish: completed-order amount is not necessarily recognized revenue or cash collected, and the undated refund ledger cannot support a dated refund cash-flow analysis.

The reviewer should not need to infer which file is the final answer or reconstruct hidden notebook state. A clean command and a small result table make the work easier to assess.

Allocate effort to the actual deliverable

For a self-imposed 90-minute practice session, one possible split is 15 minutes for the contract and source inspection, 35 for the query, 25 for validation and 15 for explanation and rerunning. This is a practice allocation, not a claim about employer time limits.

If time is short, prioritize a correct answer with visible limitations over an unfinished dashboard or unnecessary API. If performance matters in the brief, inspect a query plan and explain indexing choices using the actual workload instead of asserting that a query is “optimized.”

Exercise: add a request for amount by region. Identify the new join requirement and show how you would preserve the unmatched order under an explicit Unknown category without changing the grand total.

NeuraPath's Data Analytics with Generative AI course develops SQL alongside reconciliation and explanation. Those habits help turn a take-home submission into a clear piece of analytical work rather than a collection of advanced syntax.

Continue learning

This article is part of the Analyst career preparation and interviews sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Data Analytics with Generative AI programme — 3–4 months. The full analyst stack — Excel, SQL, Power BI and Python pipelines — then a generative-AI layer you can prove is right.

Explore Data Analytics with Generative AI
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.