The WEEK function returns a week number for a date according to rules defined by the database system.
Weekly analysis is common in sales, operations, customer activity, and performance reporting.
Determine the week number for each sales transaction.
SELECT
OrderDate,
WEEK(OrderDate) AS OrderWeek
FROM Orders;
WEEK is useful for weekly sales reporting, workforce planning, operational monitoring, and trend analysis.
- WEEK returns a week number.
- Week numbering rules vary.
- It supports weekly reporting.
- It can be combined with YEAR.
- ISO week rules may differ from database defaults.
What does WEEK return?
WEEK returns a week number associated with a date according to the database's week-numbering rules.
Why combine week and year in reporting?
The same week number can occur in different years, so including the year prevents ambiguity.