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
Multi-Tenant Ledger Schema
00:00
5 left

Multi-Tenant Ledger Schema

HardSQL · PostgreSQL

Problem

How would you design a database schema for Mercury that supports a multi-tenant ledger system where startups can track internal transactions?

Use the provided relational model to produce a tenant-isolated account summary for posted transactions during January 2025. Include accounts with no qualifying activity.

Output

  1. One row per Mercury account.
  2. Columns: startup_name, account_id, account_name, balance_cents, posted_transaction_count, latest_posted_at, and balance_rank.
  3. Include only activity from the account's startup, exclude non-posted or out-of-range transactions, and treat missing activity as zero.
  4. Order by startup, balance rank ascending, then account ID ascending.

Schema

startups
ColumnTypeDescription
idPKINTMercury startup tenant identifier
startup_nameVARCHAR(100)Startup legal or display name
ledger_accounts
ColumnTypeDescription
idPKINTLedger account identifier
startup_idINTOwning startup tenant
account_nameVARCHAR(100)Human-readable account name
account_typeVARCHAR(30)Account classification
ledger_transactions
ColumnTypeDescription
idPKINTLedger transaction identifier
startup_idINTOwning startup tenant
occurred_atDATETransaction business date
descriptionTEXTOptional transaction description
statusVARCHAR(20)Transaction lifecycle status
ledger_entries
ColumnTypeDescription
idPKINTLedger entry identifier
transaction_idINTParent ledger transaction
account_idINTAccount affected by the entry
amount_centsBIGINTSigned amount in the smallest currency unit
Tablesstartupsledger_accountsledger_transactionsledger_entries
Interviewer

Your question is Multi-Tenant Ledger Schema. Start with the requirements and the four 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.