Skip to content

Instantly share code, notes, and snippets.

@ldenson11
Created January 16, 2020 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ldenson11/b7c1a7486e251c664a19b13c52d5728b to your computer and use it in GitHub Desktop.
Save ldenson11/b7c1a7486e251c664a19b13c52d5728b to your computer and use it in GitHub Desktop.
-- detect fraudulent auths
select card as fraudulent_card,
count(*) as auth_count,
max(amount) as max_amount,
tumble_end(eventTimestamp, interval '1' second) as ts_end
from paymentauths
where amount > 10
group by card, tumble(eventTimestamp, interval '1' second)
having count(*) > 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment