Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for Corporate Action Payments
00:00
5 left

SQL for Corporate Action Payments

MediumSQL · PostgreSQL

Problem

How would you write a SQL query to find all accounts that have processed a corporate action payment of over $100,000 in the last 30 days?

Use the provided PostgreSQL tables and consider only payments marked as processed. The result should summarize qualifying payments at the account level.

Output

  1. One row per qualifying account.
  2. Return account_id, account_name, qualifying_payment_count, and maximum_payment_amount.
  3. Include payments processed from 30 days ago through today, order by maximum payment amount descending, then account ID ascending.

Schema

accounts
ColumnTypeDescription
account_idPKINTUnique account identifier
account_nameVARCHAR(100)Account display name
account_typeVARCHAR(30)Account classification
corporate_action_payments
ColumnTypeDescription
payment_idPKINTUnique payment identifier
account_idINTAccount receiving the payment
payment_amountNUMERIC(15,2)Corporate action payment amount
processed_atTIMESTAMPTimestamp when the payment was processed
statusVARCHAR(20)Payment processing status
corporate_action_typeVARCHAR(30)Type of corporate action
Tablesaccountscorporate_action_payments
Interviewer

Your question is SQL for Corporate Action Payments. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.