MySQLDate/Time FunctionsWEEK
DAYOFWEEK

WEEKDate/Time Functions

QUARTER

Returns the week number of the year for the given date.

Syntax

WEEK(date[, mode])

Example

Enter values below to update the example in real time.

order_date
week_no
total_amount
revenue
orders
-- 주차별 매출
SELECT WEEK(order_date) AS week_no, SUM(total_amount) AS revenue
FROM orders
GROUP BY week_no;