SQL Interview Question | 04 |

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

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

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

    thank you for making this type of amazing videos.

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

    Well done 👍

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

    select c1.*,c2.destination
    from
    (
    select id,source
    from flight_info as f1
    where source not in (select distinct destination from flight_info as f2 where f2.id = f1.id)
    ) as c1 join
    (
    select id,destination
    from flight_info as f1
    where destination not in (select distinct source from flight_info as f2 where f2.id = f1.id)) as c2
    using(id)

  • @Vishal2004-k5y
    @Vishal2004-k5y Месяц назад

    Please guide me I am final year student I don't have any projects made , please tell what projects should Every fresher have to be in their for getting shortlisted

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

      focus on problem solving.

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

    SELECT ID,MAX(TT),MAX(TR) FROM(
    SELECT ID,LAG(SOURCE)OVER(PARTITION BY ID ORDER BY ROWID)TT,
    LEAD(DESTINATION) OVER(PARTITION BY ID ORDER BY ROWID)TR FROM FLIGHT_INFO) GROUP BY ID ;

  • @vivekshirsat9249
    @vivekshirsat9249 Месяц назад +2

    here is my solution
    SELECT
    DISTINCT id,
    FIRST_VALUE(source)
    OVER(partition by id order by id rows between unbounded preceding and unbounded following) as source,
    LAST_VALUE(destination)
    OVER(partition by id order by id rows between unbounded preceding and unbounded following) as destination
    FROM flight_info;

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

    SELECT ID,MAX(TT),MAX(TR) FROM(
    SELECT ID,LAG(SOURCE)OVER(PARTITION BY ID ORDER BY ROWID)TT,
    LEAD(DESTINATION) OVER(PARTITION BY ID ORDER BY ROWID)TR FROM FLIGHT_INFO) GROUP BY ID ;

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

      Nice buddy, try to solve using different different approaches.