Good job! Let's move on. We now want to find out how customer acquisition has changed over time. This will help us understand if we're currently attracting more users (or not).
To that end, we'll compare the registration count values for various periods (year to year, month to month, etc.). We can use the
DATE_PART() function to create such reports:
DATE_PART('year', registration_date) AS registration_year,
COUNT(customer_id) AS registration_count
GROUP BY DATE_PART('year', registration_date)
ORDER BY DATE_PART('year', registration_date);
In our example,
DATE_PART('year', registration_date) returns the year of user registration (2016, 2017, 2018, ...).
Note that we also added an
ORDER BY clause to make sure the registration count values are shown in chronological order.