FinLearn Database Documentation

Reference documentation for the synthetic financial-company analytics database in PostgreSQL database test, schema finlearn. All people, companies, accounts, and transactions are fake training data.

1business schema
14base tables
4analytics views
1,075,526loaded rows
2022-01-01first activity date
2026-08-31latest seeded activity date

Schema Purpose

finlearn models a midsize retail financial institution. It includes customers, deposit accounts, cards, loans, transactions, risk history, support interactions, marketing campaigns, and exchange rates. The data is designed for SQL learning, dashboard development, segmentation, cohort analysis, operational reporting, and introductory risk analytics.

Core grain examples: one row per customer in customers, one row per account in accounts, one row per posted or attempted money movement in account_transactions, one row per scheduled loan installment in loan_payments, and one row per customer-campaign send in campaign_responses.

Data Model

customersCentral party table for households and consumers.
accountsDeposit and brokerage accounts owned by customers.
account_transactionsHigh-volume money movement fact table for account activity.
loansLoan accounts for credit exposure and delinquency analysis.
loan_paymentsMonthly loan payment performance history.
credit_score_historySemiannual bureau snapshots for risk modeling.
campaign_responsesMarketing funnel events tied to customers and campaigns.
support_ticketsCustomer service history for experience analytics.
18 documented objects

Schema: finlearn

Owns every object in the training database. Scripts intentionally drop and recreate only this schema, leaving other schemas in test untouched.

schemaPostgreSQL

branches

Branch dimension used to analyze deposits, loans, acquisition, and regional performance.

15 rowsdimension
ColumnTypeKeyNullableDescription
branch_idsmallint identityPKNoSurrogate branch identifier.
branch_codetextUniqueNoShort operational code for the branch.
branch_nametextNoReadable branch name.
regiontextNoSales and operations region.
state_codechar(2)NoUS state abbreviation.
citytextNoBranch city.
opened_datedateNoDate when the branch opened.

financial_products

Product catalog for deposits, cards, loans, and investments. Referenced by accounts, cards, and loans.

10 rowsdimension
ColumnTypeKeyNullableDescription
product_idsmallint identityPKNoSurrogate product identifier.
product_codetextUniqueNoShort product code used in business logic.
product_nametextNoCustomer-facing product name.
product_familytextNoOne of Deposit, Credit Card, Loan, or Investment.
risk_weightnumeric(5,3)NoSimplified relative risk weight for analysis exercises.
monthly_feenumeric(8,2)NoStandard monthly account or product fee.
standard_ratenumeric(7,4)NoNominal product rate or APR baseline.

customers

Customer master table with demographics, financial profile, onboarding channel, KYC status, and active flag.

15,000 rowsdimension
ColumnTypeKeyNullableDescription
customer_idinteger identityPKNoSurrogate customer identifier.
customer_numbertextUniqueNoExternal customer number.
first_nametextNoSynthetic first name.
last_nametextNoSynthetic last name.
emailtextUniqueNoFake email address using the training domain.
phonetextNoFake phone number.
birth_datedateNoDate of birth for age-based analysis.
gendertextNoGender category.
state_codechar(2)NoCustomer residence state.
citytextNoCustomer residence city.
postal_codetextNoFive-digit synthetic postal code.
annual_incomenumeric(12,2)NoEstimated annual income in USD.
employment_statustextNoEmployment category.
risk_segmenttextNoLow, Medium, or High risk segment.
acquisition_channeltextNoHow the customer joined.
joined_datedateNoCustomer onboarding date.
kyc_statustextNoKnow-your-customer review status.
is_activebooleanNoWhether the customer relationship is active.

accounts

Account-level table for deposit and brokerage products. Useful for balance, retention, product mix, and branch analysis.

26,000 rowsfact/dimension
ColumnTypeKeyNullableDescription
account_idinteger identityPKNoSurrogate account identifier.
customer_idintegerFK customersNoOwner customer.
branch_idsmallintFK branchesNoOriginating or servicing branch.
product_idsmallintFK productsNoFinancial product assigned to the account.
account_numbertextUniqueNoSynthetic external account number.
account_typetextNoChecking, Savings, Money Market, or Brokerage.
opened_datedateNoAccount opening date.
closed_datedateYesAccount closure date when closed.
statustextNoOpen, Closed, Dormant, or Frozen.
currency_codechar(3)NoAccount currency, seeded as USD.
current_balancenumeric(14,2)NoCurrent balance snapshot.
overdraft_limitnumeric(12,2)NoAvailable overdraft line for checking accounts.

merchants

Merchant dimension for card purchases and debit activity. Supports category spend, online spend, and fraud-pattern exercises.

800 rowsdimension
ColumnTypeKeyNullableDescription
merchant_idinteger identityPKNoSurrogate merchant identifier.
merchant_nametextNoSynthetic merchant name.
merchant_categorytextNoSpend category such as Grocery, Fuel, Travel, or Utilities.
risk_tiertextNoMerchant risk classification.
state_codechar(2)YesMerchant state when location-based.
online_onlybooleanNoTrue for online-only merchants.

cards

Credit card account records tied to customers and their checking relationship.

13,520 rowscredit
ColumnTypeKeyNullableDescription
card_idinteger identityPKNoSurrogate card identifier.
customer_idintegerFK customersNoCardholder customer.
account_idintegerFK accountsNoLinked account relationship.
product_idsmallintFK productsNoCredit card product.
card_number_last4char(4)NoLast four digits only, synthetic.
issued_datedateNoIssue date.
expiration_datedateNoExpiration date.
credit_limitnumeric(12,2)NoApproved credit limit.
aprnumeric(6,4)NoAnnual percentage rate.
statustextNoActive, Closed, Blocked, or Expired.

loans

Loan fact table for credit exposure, product mix, delinquency, branch performance, and portfolio analysis.

7,000 rowscredit
ColumnTypeKeyNullableDescription
loan_idinteger identityPKNoSurrogate loan identifier.
customer_idintegerFK customersNoBorrower customer.
branch_idsmallintFK branchesNoOriginating branch.
product_idsmallintFK productsNoLoan product.
loan_numbertextUniqueNoSynthetic loan number.
loan_typetextNoAuto, Mortgage, Personal, or Small Business.
origination_datedateNoLoan start date.
maturity_datedateNoContractual final payment date.
original_amountnumeric(14,2)NoOriginal principal amount.
interest_ratenumeric(6,4)NoAnnual interest rate.
term_monthssmallintNoContract term length.
outstanding_balancenumeric(14,2)NoCurrent unpaid balance snapshot.
delinquency_daysintegerNoDays past due.
statustextNoCurrent, Late, Default, Paid Off, or Charged Off.

account_transactions

Largest fact table. Contains deposit, debit, card, transfer, fee, interest, wire, and fraud-flag activity from 2022 through August 2026.

500,000 rowsfact
ColumnTypeKeyNullableDescription
transaction_idbigint identityPKNoSurrogate transaction identifier.
account_idintegerFK accountsNoAccount affected by the transaction.
merchant_idintegerFK merchantsYesMerchant for card purchase or ACH debit transactions.
transaction_tstimestampNoTransaction timestamp.
transaction_typetextNoBusiness transaction type.
channeltextNoATM, Branch, Card, Mobile, Online, or System.
amountnumeric(12,2)NoSigned amount; credits are positive and debits are negative.
balance_afternumeric(14,2)NoAccount balance after the transaction.
statustextNoPosted, Pending, Rejected, or Reversed.
descriptiontextNoReadable transaction description.
is_fraud_flagbooleanNoTraining flag for suspected fraudulent card activity.

loan_payments

Installment schedule and performance history for loans. Supports delinquency, collections, and cash-flow analytics.

248,693 rowsfact
ColumnTypeKeyNullableDescription
payment_idbigint identityPKNoSurrogate payment identifier.
loan_idintegerFK loansNoLoan being billed or paid.
due_datedateNoScheduled installment due date.
paid_datedateYesActual payment date when paid or late.
scheduled_amountnumeric(12,2)NoTotal amount scheduled for the installment.
principal_amountnumeric(12,2)NoPrincipal portion.
interest_amountnumeric(12,2)NoInterest portion.
late_feenumeric(10,2)NoLate fee assessed.
statustextNoScheduled, Paid, Late, Missed, or Partial.

credit_score_history

Semiannual credit bureau snapshots for customer risk features and score migration analysis.

150,000 rowsrisk
ColumnTypeKeyNullableDescription
score_idbigint identityPKNoSurrogate score record identifier.
customer_idintegerFK customersNoCustomer being scored.
score_datedateNoScore snapshot date.
credit_scoresmallintNoCredit score from 300 to 850.
bureautextNoEquifax, Experian, or TransUnion.
utilization_pctnumeric(5,2)NoCredit utilization percentage.
inquiries_12msmallintNoNumber of hard inquiries in the prior 12 months.

support_tickets

Customer service cases for operational workload, service quality, and churn-signal exercises.

20,000 rowsoperations
ColumnTypeKeyNullableDescription
ticket_idinteger identityPKNoSurrogate ticket identifier.
customer_idintegerFK customersNoCustomer who opened the case.
account_idintegerFK accountsYesRelated account when the case is account-specific.
opened_tstimestampNoTicket open timestamp.
closed_tstimestampYesClose timestamp for resolved tickets.
issue_categorytextNoPrimary issue type.
prioritytextNoLow, Medium, High, or Urgent.
channeltextNoCustomer contact channel.
statustextNoOpen, Closed, Escalated, or Waiting on Customer.
satisfaction_scoresmallintYesCustomer rating from 1 to 5 for closed tickets.

marketing_campaigns

Campaign definitions for marketing attribution and funnel analytics.

8 rowsdimension
ColumnTypeKeyNullableDescription
campaign_idsmallint identityPKNoSurrogate campaign identifier.
campaign_nametextNoReadable campaign name.
product_familytextNoProduct family promoted by the campaign.
start_datedateNoCampaign start date.
end_datedateNoCampaign end date.
channeltextNoEmail, In App, Mail, Paid Search, or SMS.
budgetnumeric(12,2)NoCampaign budget in USD.

campaign_responses

Customer-level campaign funnel events. A row represents one customer sent one campaign.

59,960 rowsfact
ColumnTypeKeyNullableDescription
response_idbigint identityPKNoSurrogate response identifier.
campaign_idsmallintFK campaignsNoCampaign sent to the customer.
customer_idintegerFK customersNoCustomer who received the campaign.
sent_tstimestampNoSend timestamp.
opened_tstimestampYesOpen timestamp when applicable.
clicked_tstimestampYesClick timestamp when applicable.
converted_tstimestampYesConversion timestamp when applicable.
conversion_valuenumeric(12,2)NoEstimated value of the conversion.

fx_rates

Daily currency conversion reference rates against USD for multi-currency analytics practice.

8,520 rowsreference
ColumnTypeKeyNullableDescription
rate_datedatePKNoRate effective date.
currency_codechar(3)PKNoISO-like currency code.
usd_ratenumeric(12,6)NoCurrency rate relative to USD.

Analytics Views

Convenience views are included for students who are ready to work with prepared analytical datasets before building their own transformations.

4 views
ViewRowsGrainDescription
v_customer_36015,000One row per customerCustomer profile with account counts, total balances, loan exposure, latest credit score, support tickets, and campaign conversions.
v_credit_risk_features15,000One row per customerRisk modeling features including latest score, utilization, inquiries, active loans, delinquency, and non-current payments.
v_account_activity_monthly268,624One row per account per active monthMonthly transaction volume, inflows, outflows, fraud flags, and exception counts.
v_monthly_branch_kpis1,501One row per branch per account-opening monthMonthly new account, closed account, and balance snapshot measures by branch and region.

Indexes

Indexes support common joins and date-filtered analytics while keeping the schema readable for learners.

12 indexes
  • idx_customers_joined_date
  • idx_customers_state_risk
  • idx_accounts_customer
  • idx_accounts_branch_product
  • idx_transactions_account_ts
  • idx_transactions_type_ts
  • idx_transactions_merchant
  • idx_loans_customer_status
  • idx_loan_payments_loan_due
  • idx_scores_customer_date
  • idx_tickets_customer_opened
  • idx_campaign_responses_campaign

Starter Exercises

Use these questions to guide lessons or assignments.

  • Which branch regions have the highest deposit balances and account growth?
  • Which merchant categories produce the most fraud flags or reversed transactions?
  • How do credit score, utilization, and delinquency differ by risk segment?
  • Which marketing channels convert best after normalizing by campaign budget?
  • What percentage of loan payments are late, missed, or partial by loan type?
  • Which customers have high balances, recent support tickets, and no campaign conversion?
set search_path to finlearn; select risk_segment, count(*) as customers, round(avg(credit_score), 1) as avg_score, round(avg(outstanding_loan_balance), 2) as avg_loan_exposure from v_credit_risk_features group by risk_segment order by risk_segment;