TransWikia.com

SQL query question

Computer Science Asked by Breta Kapedani on July 27, 2020

Examine the following SQL query, and explain clearly and succinctly what it means. Will
the query work? Explain why or why not.

WITH​ ​processed_users
​AS​ ​(​SELECT​ ​LEFT​(u​.​phone_country​,​ 2​)​ ​AS​ ​short_phone_country​,
 SELECT​ FROM​
WHERE​ GROUP​ ORDER​
​u​.​id ​FROM​ ​users​ ​u)
​t​.​user_id​,
​t​.​merchant_country​,
​Sum(​ t​.​amount​ ​/​ ​fx​.​rate​ ​/​ ​Power(​ ​10​,​ ​cd​.​exponent))​ ​AS​ ​amount ​transactions​ ​t
​JOIN​ ​fx_rates​ ​fx
​ON​ ​(​ ​fx​.​ccy​ ​=​ ​t​.​currency
​AND​ ​fx​.​base_ccy​ ​=​ ​'EUR'​ ​)
​JOIN​ ​currency_details​ ​cd
​ON​ ​cd​.​currency​ ​=​ ​t​.​currency
​JOIN​ ​processed_users​ ​pu ​ON​ ​pu​.​id​ ​=​ ​t​.​user_id
​t​.​source​ ​=​ ​'GAIA'
​AND​ ​pu​.​short_phone_country​ ​=​ ​t​.​merchant_country ​BY​ ​t​.​user_id​,
​t​.​merchant_country ​BY​ ​amount​ ​DESC​
  1. Find 5 likely fraudsters (not already found in fraudsters.csv!), provide their user_ids, and explain how you found them and why they are likely fraudsters.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP