End of Summer - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Customer cohorts
Summary

Instruction

Very well done! We can now calculate the registration count for the current week, month, year, etc. with this query:

SELECT COUNT(customer_id) AS registration_count
FROM customers
WHERE registration_date >= DATE_TRUNC('year', CURRENT_DATE);

We used the DATE_TRUNC() function to find the beginning of the year to get the number of registrations in the current year.

Exercise

Show the number of registrations in the current week. Name the column registrations_current_week.

Stuck? Here's a hint!

Use DATE_TRUNC() as we did in the explanation. Change year to week.