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
Second-Highest Transaction for Advisor
00:00
5 left

Second-Highest Transaction for Advisor

MediumSQL · PostgreSQL

Problem

Raymond James Financial Services needs to review transaction activity for a specific advisor account. Write a PostgreSQL query that returns the second-highest distinct posted financial transaction amount for account RJ-1042.

Requirements

  1. Join advisor_accounts to financial_transactions using the account identifier.
  2. Consider only transactions for account RJ-1042 with a POSTED status and a non-NULL amount.
  3. Rank distinct transaction amounts from highest to lowest within the account, and return every transaction tied at the second-highest amount.
  4. Return the account number, transaction ID, and transaction amount, ordered by transaction ID.

Schema

advisor_accounts
ColumnTypeDescription
account_idPKINTInternal advisor account identifier
account_numberVARCHAR(20)Raymond James advisor account number
advisor_nameVARCHAR(100)Advisor assigned to the account
financial_transactions
ColumnTypeDescription
transaction_idPKINTUnique transaction identifier
account_idINTAdvisor account associated with the transaction
transaction_typeVARCHAR(30)Type of financial transaction
amountNUMERIC(12,2)Transaction amount
statusVARCHAR(20)Transaction processing status
currencyVARCHAR(3)ISO currency code
Tablesadvisor_accountsfinancial_transactions
Interviewer

Your question is Second-Highest Transaction for Advisor. Start with the requirements and the two 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.