Sql Function

tcl

λ‚ μ§œ μ‹œκ°„λ³„ 뢄석 문제 λͺ¨μŒ

select now(); select current_date() select extract(month from β€˜2024-10-22’) select day(β€˜2024-10-22’) select date_add(β€˜2024-10-22’, interval 7 day) select date_sub(β€˜2024-10-22’, interval 7 day) select datediff(β€˜2024-10-22’, β€˜2024-10-24’) select timediff(β€˜2024-10-22’, β€˜2024-10-24’) select date_format(now(), β€œ%Y-%m-%d)

  1. dau : daily active user 2020λ…„ 7μ›”μ˜ 평균 Dauλ₯Ό κ΅¬ν•˜κΈ°. active user μˆ˜κ°€ μ¦κ°€ν•˜λŠ” μΆ”μ„ΈμΈκ°€μš”?

select date_format(visited_at - interval 9 hour, β€˜%Y-%m-%d), count(distinct(user_id)) from tbl_visit where visited_at >= β€˜2020-07-01’ and visited_at <= β€˜2020-07-31’

μ‹œκ°„ 포맷은 항상 μ‹€μ œ μ‹œκ°„μ„ ν™•μΈν•΄μ•Όν•œλ‹€.

Updated:

Leave a comment