I am not a SQL developer, but I need to make a request to sample the movement of accounts for the last month, aggregate information by client country.
I could only create an sample database but I have no idea what to do next.
Advertisement
Answer
Your question isn’t totally clear what you are looking for, but you will need to use an aggregate function like SUM or COUNT as well as using a GROUP BY depending on what you need.
Here is a sum of the amount of transactions by country as an example.
select country, sum(transactions.amount) as TOTAL_AMT from clients as clients inner join accounts as accounts on accounts.client_id = clients.client_id inner join transactions as transactions on transactions.sender_account_id = accounts.account_id group by country;