mysql week start date code example
Example 1: sql select data from last week
select id from tbname
where date between date_sub(now(),INTERVAL 1 WEEK) and now();
Example 2: mysql one week ago
SELECT sysdate() - 7; -- 1 week ago 12/01/2021 14:27:27
SELECT date(sysdate() - 7); -- 1 week ago 12/01/2021 00:00:00
SELECT * FROM my_table WHERE my_datecol > date(sysdate() - 7);
Example 3: mysql date of the week
DAYOFWEEK(date)