Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Customer registration
Customer cohorts
Summary

Instruction

Very well done! Let's do one more exercise.

Exercise

Find the registration count for each week in each year. Show the following columns: RegistrationYear, RegistrationWeek, and RegistrationCount. Order the results by the year and week.

Note: When a week is split between two years, SQL Server splits that week's days into two different weeks. For example, 30 December 2019 is a Monday, and 5 January 2020 is the Sunday of that week. December 30 and 31 will be classified as week 53 of 2019, while January 1-5 will be classified as week 1 of 2020.

Stuck? Here's a hint!

To get the week number from a date, use:

DATEPART(week, RegistrationDate)