#sql

Поделиться
HTML-код
  • Опубликовано: 9 июн 2023
  • Hi All,
    My name is Ankit Shrivastava and I am a Data Engineer.
    Today this #vlog is regarding #sql - SQL query to find all numbers that appear at least three times consecutively
    DDL for practice:-
    create table num_test (id int,num int)
    insert into num_test values (1,1);
    insert into num_test values (2,1);
    insert into num_test values(3,1);
    insert into num_test values(4,2);
    insert into num_test values(5,3);
    insert into num_test values(6,3);
    Please find the link of my all previous videos:-
    #sql - Multiple ways to create table in #database | with data, without data, with filter condition
    • #sql - Multiple ways t...
    #sql - Calculate business day between two dates including weekend, holiday and if holiday on weekend
    • #sql - Calculate busin...
    #aws S3-IAM-Redshift | Copy data from S3 to Redshift and vice versa using IAM role & policy #amazon
    • #aws S3-IAM-Redshift |...
    #sql interview question How to achieve Organisational hierarchy using self join from one table | DE
    • #sql interview questio...
    #sql Count occurence of character in a string / Count occurrence of word in a sentence #data analyst
    • #sql Count occurence o...
    #sql - difference between WHERE & AND clause with LEFT/RIGHT join | INNER join+WHERE=LEFT join+WHERE
    Link • #sql - difference betw...
    #sql How to handle NULL while aggregation | SUM() | AVG() | Data Analyst | Data Engineer |Math calc
    • #sql How to handle NUL...
    #sql Calculate start & end time and average time spent in successful transaction | startup interview
    Link • #sql Calculate start &...
    #sql to achieve last NOT NULL value from the record | Analytical Function | Data Engg | Data Analyst
    Link • #sql to achieve last N...
    #sql to identify Top Performing Product every Quarter of each year | Highest sale every quarter
    Link • #sql to identify Top P...
    #sql Interview Question - Calculate Running Total | Cumulative sum | UNBOUNDED PRECEDING FOLLOWING
    Link • #sql Interview Questio...
    #sql Interview question - Schedule cricket match between teams and generate points table using SQL
    Link lnkd.in/dsM8Pe8B
    #sql Interview Questions - All JOINS (INNER, LEFT, RIGHT, FULL OUTER) | JOIN only NULL values
    Link lnkd.in/dJttWQBB
    #sql Interview Question - What is the difference between COUNT(*), COUNT(1) and COUNT(-1)
    Link lnkd.in/dVHMWxKj
    #SQL Interview Question - How to delete duplicate record from table
    Link lnkd.in/dcVyhC7X
    #SQL Interview Question -Second highest salary using dense rank analytical function
    Link lnkd.in/daBumQfB
    #SQL to pull unique record after combination of column
    #SELFJOIN
    Link lnkd.in/d6tXYXCv
    #SQL Join on duplicate values all four joins (INNER, LEFT, RIGHT, FULL OUTER)
    Link lnkd.in/d9HcwkZs
  • НаукаНаука

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

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

    Thank you, very helpful, please make more trick question videos.

  • @shuchisahay7446
    @shuchisahay7446 Год назад +1

    Very detailed. Helped me in one of the interviews. Thanks for sharing such sessions.

  • @ansh912
    @ansh912 Год назад

    Informative problem and solution.

  • @abhisheksrivastava5660
    @abhisheksrivastava5660 4 месяца назад

    Lets Suppose if we want to find 10th consecutive number then writing multiple lead function is not good. Please provide a more generic solution

  • @jayakrishnasurampudi3146
    @jayakrishnasurampudi3146 11 месяцев назад

    with data as
    (select distinct num,
    lead(num,1) over(order by num ) as x1,
    lead(num,2) over(order by num ) as x2
    from Logs
    )select distinct num as ConsecutiveNums from data
    WHERE num=x1 AND x1 = x2;