select 
day
,case
when month(day) != month(date_add(day,7)) then 'y'
else 'n'
end as is_last_week -- 是否月份最后一周
from (
select '2021-06-06' as day union all
select '2021-06-13' as day union all
select '2021-06-20' as day union all
select '2021-06-27' as day union all
select '2021-07-04' as day union all
select '2021-07-11' as day union all
select '2021-07-18' as day union all
select '2021-07-25' as day union all
select '2021-08-01' as day
) t1
;