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
SQL From Easy to Hard
00:00
5 left

SQL From Easy to Hard

MediumSQL · PostgreSQL

Problem

How would you demonstrate your SQL skills from easy to hard problems?

Use the provided tables to produce a progressively realistic analytical result involving users, fee tiers, and Spot trading activity. Include only filled trades executed during January 2025, while retaining users with no qualifying trades.

Output

  1. One row per user, with user_id, tier_name, total_volume, and volume_rank
  2. total_volume is the user's January filled-trade quote volume, with zero for no qualifying trades
  3. Ranks restart for each tier, with tied volumes sharing a rank
  4. Sort by tier_name, volume_rank, then user_id

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
fee_tier_idINTUser's fee tier
countryVARCHAR(2)Two-letter country code
signup_dateDATEDate the user registered
fee_tiers
ColumnTypeDescription
tier_idPKINTUnique fee tier identifier
tier_nameVARCHAR(30)Fee tier label
fee_rateDECIMAL(8,6)Trading fee rate
trades
ColumnTypeDescription
trade_idPKINTUnique trade identifier
user_idINTUser who initiated the trade
symbolVARCHAR(20)Spot trading pair
quote_amountDECIMAL(18,2)Trade value in the quote asset
trade_statusVARCHAR(20)Trade processing status
executed_atDATETrade execution date
Tablesusersfee_tierstrades
Interviewer

Your question is SQL From Easy to Hard. 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.