DATE_FORMAT
function to extract the year and month from the trans_date
column and alias it as month
.country
column as is.COUNT
function to count the total number of transactions for each group and alias it as trans_count
.SUM
function with a CASE WHEN
expression to count the number of approved transactions and alias it as approved_count
.SUM
function to calculate the total amount of transactions for each group and alias it as trans_total_amount
.SUM
function with a CASE WHEN
expression to calculate the total amount of approved transactions and alias it as approved_total_amount
.month
and country
.erDiagram Transactions { int id PK varchar country enum state int amount date trans_date }