Microsoft SQL Interview Question (Medium Level) | Find the Company with Most Desktop-Only Users

Поделиться
HTML-код
  • Опубликовано: 18 дек 2024

Комментарии • 4

  • @chugalirani18
    @chugalirani18 4 дня назад +1

    amazing series

  • @HARSHRAJ-gp6ve
    @HARSHRAJ-gp6ve 10 дней назад +1

    with cte as(
    select customer_id,COUNT(*) as c1,
    COUNT(CASE when client_id="desktop" THEN 1 ELSE NULL END) as x1
    FROM fact_events GROUP BY customer_id
    )
    select customer_id FROM (select cte.*,DENSE_RANK()OVER(ORDER BY c1 DESC) as r1 FROM cte where c1=x1)
    as es where r1=1;

  • @HARSHRAJ-gp6ve
    @HARSHRAJ-gp6ve 10 дней назад +1

    Bro if you find any kind of error in my query on any solutions I post in it, plese comment also for the same