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
Rolling Five-Minute Transaction Threshold
00:00
5 left

Rolling Five-Minute Transaction Threshold

HardSQL · PostgreSQL

Problem

NICE Actimize monitors transaction activity for rapid bursts that may indicate suspicious behavior. Write a PostgreSQL query to identify users who exceed three transactions in any inclusive rolling five-minute window.

Requirements

  1. Partition activity by user_id and order it by transaction_ts.
  2. Count transactions from the current timestamp through the preceding five minutes, including both boundaries.
  3. Return only users whose maximum window count is greater than three.
  4. Include the earliest timestamp where the threshold was exceeded and the maximum transaction count observed.
  5. Ignore rows with a missing user_id or transaction_ts, and sort results by user_id.

Schema

customer_transactions
ColumnTypeDescription
transaction_idPKBIGINTUnique transaction identifier
user_idBIGINTCustomer or account identifier
transaction_tsTIMESTAMPTZTimestamp when the transaction occurred
amountNUMERIC(12,2)Transaction amount
Tablescustomer_transactions
Interviewer

Your question is Rolling Five-Minute Transaction Threshold. Start with the requirements and the one table 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.