Instruction
- Write a query to count the number of customers who spend more than > $20 by month
- You can use
EXTRACT(YEAR from timestamp_col)
andEXTRACT(MONTH from timestamp_col)
to get year and month from a timestamp column. - Hint: a customer's spend varies every month.
Table: payment
Movie rental payment transactions table
col_name | col_type --------------+-------------------------- payment_id | integer customer_id | smallint staff_id | smallint rental_id | integer amount | numeric payment_ts | timestamp with time zone
Sample results
year mon num_hp_customers 2020 2 158 2020 5 520