Instruction

  • Write a query to return the number of good days and bad days in May 2020 based on number of daily rentals.
  • Return the results in one row with 2 columns from left to right: good_days, bad_days.
  • good day: > 100 rentals.
  • bad day: <= 100 rentals.
  • Hint (For users already know OUTER JOIN), you can use dates table
  • Hint: be super careful about datetime columns.
  • Hint: this problem could be tricky, feel free to explore the rental table and take a look at some data.

Table: rental


   col_name   | col_type
--------------+--------------------------
 rental_id    | integer
 rental_ts    | timestamp with time zone
 inventory_id | integer
 customer_id  | smallint
 return_ts    | timestamp with time zone
 staff_id     | smallint

Sample results

good_days | bad_days
-----------+----------
         7 |       24