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;
Nesta página do site você pode assistir ao vídeo on-line New & Returning Users | SQL Interview Question duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Absent Data 06 Fevereiro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,233 vezes e gostou 113 espectadores. Boa visualização!