New & Returning Users | SQL Interview Question

Publicado el: 06 febrero 2024
en el canal de: Absent Data
2,233
113

You will be tasked with finding the new and returning daily users based on a simple dataset of datetime and users. You can see how the query is built below. #sqlinterview

with first_visit_cte as (
select
user_id,
min(datetime) as first_visit
from
user_activity
group by
user_id
)
select
count(case when a.datetime = b.first_visit then "New" end) as New_Users,
count(case when a.datetime != b.first_visit then "Return" end) as Returning_Users
from
user_activity a
join
first_visit_cte b
on
a.user_id = b.user_id;


En esta página del sitio puede ver el video en línea New & Returning Users | SQL Interview Question de Duración hora minuto segunda en buena calidad , que subió el usuario Absent Data 06 febrero 2024, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 2,233 veces y le gustó 113 a los espectadores. Disfruta viendo!