SYMMETRIC PAIRS | SQL Interview Question and Answers | HackerRank | Self Join | Deepankar Pathak

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

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

  • @jnanapradhana3377
    @jnanapradhana3377 Месяц назад +1

    with cte as(
    select s1.x as s1x,s1.y as s1y,s2.x as s2x,s2.y as s2y,case when s1.x=s2.y and s2.x=s1.y then 1 end as con from Symmetric_Pair as s1 join Symmetric_Pair as s2 on 1=1)
    select distinct s1x as x ,s1y as y from cte where con=1 and s1x

  • @KapilKumar-hk9xk
    @KapilKumar-hk9xk Месяц назад +1

    awesome bro...1 qk suggestion. Pls flash the expected output before starting to write queries. That will be helpful...

  • @tanvi1394
    @tanvi1394 Месяц назад

    I am just start to learn SQL but i subscribe your channel in future understanding

    • @deepankarpathak983
      @deepankarpathak983  Месяц назад

      That's great to hear that. We are also planning to launch a course on RUclips for 'SQL FROM ZERO TO HERO'.

  • @vijay.s-ll1yq
    @vijay.s-ll1yq Месяц назад +1

    WITH CTE AS
    (SELECT *,CASE WHEN X< Y THEN X ELSE Y END AS x1,
    CASE WHEN X

  • @saurabhagrawal5466
    @saurabhagrawal5466 Месяц назад +1

    10-Oct-2024

  • @HARSHRAJ-gp6ve
    @HARSHRAJ-gp6ve Месяц назад +1

    with cte as(
    select Symmetric_Pair.*,ROW_NUMBER()OVER(ORDER BY X) as x1 FROM Symmetric_Pair
    ),cte1 as(
    select Symmetric_Pair.*,ROW_NUMBER()OVER(ORDER BY X) as x2 FROM Symmetric_Pair
    )
    select cte.X,cte.Y FROM cte JOIN cte1 ON cte.X=cte1.Y AND cte.Y=cte1.X and x1