Best April deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Customer registration
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(CustomerID) AS RegistrationCount
FROM Customers
WHERE RegistrationDate >= DATEADD(year, DATEDIFF(year, 0, GETDATE()), 0);

We used the trick with DATEADD() that we learned previously to get the number of registrations in the current year.

Exercise

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

Stuck? Here's a hint!

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