PMC ANALYTICS INTERVIEW QUESTION - Retrieve start date and end date based on the sequential data

Sdílet
Vložit
  • čas přidán 30. 06. 2024
  • DML Script: datasculptor.blogspot.com/202...
    Feedback: forms.gle/NQuCAy7p5a9wxW3LA
    The Data Sculptor CZcams channel is a dedicated platform that explores the art and science of working with data. This channel caters to a diverse audience, including data enthusiasts, analysts, scientists, and anyone interested in harnessing the power of data for insightful and creative purposes.
    The channel covers a wide range of topics related to data manipulation, analysis, visualization, and interpretation. The term "Data Sculptor" emphasizes the creative aspect of working with data, suggesting that it's not just about raw numbers but also about crafting meaningful stories and insights from the information available.
    Viewers can expect a variety of content, including tutorials on popular data analysis tools and programming languages, discussions on emerging trends in the data field, case studies showcasing innovative data applications, and tips for effective data communication. The Data Sculptor aims to demystify complex concepts, making data-related skills accessible to both beginners and experienced professionals.
    Whether you're a student looking to enter the field of data science, a business professional seeking to enhance your analytical skills, or simply someone curious about the world of data, the Data Sculptor CZcams channel strives to provide engaging and informative content to help you navigate the exciting realm of data exploration and analysis.
    Playlists:
    SQL Interview Questions: • SQL Interview questions
    Recursive CTE: • Recursive CTE
    Power BI: • Power BI and DAX
    Data Modeling: • Data Modelling
    Generative AIs: • Generative AIs
    Excel: • Excel
    Follow me
    Linkedin: / data-sculptor-93a00b2a8
    Instagram: / datasculptor2895
    Quora: datasculptorsspace.quora.com/
    BuyMeACoffee: buymeacoffee.com/datasculptor

Komentáře • 5

  • @varunas9784
    @varunas9784 Před 20 dny

    Thanks for the video!
    Here's my attempt..
    =======================================================
    with cte as (select *,
    case when DATEDIFF(DAY, (LAG(End_Date, 1, Start_Date) over(order by task_id)), Start_Date)

  • @GowthamR-ro2pt
    @GowthamR-ro2pt Před měsícem

    My Approach would be :
    with cte as (SELECT *,row_number() over (order by (select null)) rn,DATEADD(DAY,row_number() over (order by (select null)),'1900-01-01') flag,
    Start_Date - DATEADD(DAY,row_number() over (order by (select null)),'1900-01-01') flag1
    FROM Schedule1),
    cte1 as
    (select *,count(flag1) over (partition by flag1 ) flag3 from cte)
    select min(Start_Date) Sdate,max(End_Date)Edate from cte1
    group by flag3,flag1

  • @vijaygupta7059
    @vijaygupta7059 Před měsícem

    My solution in MSSQL DB :
    with cte1 as
    (
    SELECT *,row_number()over(order by Task_ID) as rn
    ,DATEADD(day, row_number()over(order by Task_ID), '1900-01-01' ) as rn1
    FROM Schedule
    ),cte2 as
    (
    Select *
    ,datediff(day,rn1,Start_Date) as rn2
    from cte1
    )
    Select min(Start_Date) as Start_Date, max(End_Date) as End_Date
    from cte2
    group by rn2

  • @shreecrafts651
    @shreecrafts651 Před měsícem

    I feel like you making it more complex