Write Complex SQL Queries | Interview questions with Solution | Windows Function |

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • ▶ Evaluate yourself if you can become a successful Business Analyst
    topmate.io/ana...
    ▶ In SQL Wednesdays, I will cover 1 problem that has been asked in FAANG Interviews. So, watch these videos to improve your chances to crack the interviews.
    Happy SQL Learning!
    💡 SQL TUTORIAL FOR BEGINNERS
    ========================
    SQL Series:
    • What is SQL | Understa...
    SQL Introduction (Part1):
    • SQL Tutorial for Begin...
    SQL Beginner Level 17 Questions (Part2):
    • Top 17 SQL Queries wit...
    SQL Intermediate Level 24 Questions (Part3): • 24 SQL Query Interview...
    💡 END-TO-END POWER BI DASHBOARD
    ========================
    Power BI Dashboards --
    1 ▶ • End-To-End Power BI Pr...
    2 ▶ • End-To-End Power BI Da...
    3 ▶ • Microsoft POWER BI Tut...
    #sql #sqlqueries

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

  • @analyticalguy
    @analyticalguy  Год назад +2

    SQL Query script for your reference:
    drive.google.com/file/d/1ffb1mRHuPzoHPTisDFwXXX9p5lbzyHLP/view?usp=share_link

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

    Thanks a million sir,
    Mr Jain Akitant...
    Thanks for all you do and represents...

  • @shivyogi806
    @shivyogi806 Год назад +2

    Super 👌 Bhai you must keep posting advance SQL, slow and steady progress.
    God Bless and meditate daily 🙏

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

      Thank you Shiv for your kind words. Let me know if you need any particular kind of assistance in SQL.

  • @surajkumarsaw7398
    @surajkumarsaw7398 9 месяцев назад

    I tried by this:
    with cte as
    (select year, Salesman, Sales,
    lead(sales) over(partition by salesman order by year) as lead_sales
    from salesdump
    ),
    flag_cte as (
    select salesman,
    (case when sales>lead_sales then 0 else 1 end) as flag
    from cte
    )
    select salesman from flag_cte where flag=1 group by salesman having count(flag)>=4

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

    Superb performance❤ Thanks a lot. Can you make a video for using trigger in sql and views please🙏

    • @analyticalguy
      @analyticalguy  Год назад +2

      Thanks for your kind words Satish. Yes I’ll definitely make those videos soon.

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

      @@analyticalguy thanks a lot for considering it.

  • @srushtiOm
    @srushtiOm 2 месяца назад

    with cte as (
    select *,
    rank() over(partition by salesman order by year, sales) as rnk
    from salesdump),
    cte_1 as (
    Select *,
    case when sales < lead(sales) over (partition by salesman order by year, sales) then 1
    when sales < lead(sales,2) over (partition by salesman order by year, sales) then 1
    when sales < lead(sales,3) over (partition by salesman order by year, sales) then 1
    when sales > lag(sales,1) over (partition by salesman order by year, sales) then 1
    else 0
    end as 'Result'
    from cte)
    Select * from cte_1
    where Result = 1
    Is this a valid solution? I could get the final solution.

  • @Fatima-gw7sm
    @Fatima-gw7sm Год назад

    How to do the same in workbench? When comparing null and sales it shows null is less than sales and the flag is 0

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

    Where is sql script?

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

      drive.google.com/file/d/1ffb1mRHuPzoHPTisDFwXXX9p5lbzyHLP/view?usp=share_link

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

    Would it be rude to ask for your email address

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

      Hi, my email id is analyticalguys@gmail.com

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

    Thanks a million sir,
    Mr Jain Akitant...
    Thanks for all you do and represents...

    • @analyticalguy
      @analyticalguy  Год назад +2

      You’re welcome. Let me know what else I can help you with :)

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

      @@analyticalguy
      Okay sir, thanks for the large heartedness...
      I need help on understandi how to write nested CASE statements ; business case scenarios on working with the Window functions ( LAG,LEAD, ROW_NUMBER)_ like typical business use cases for them not random usage.
      Thanks a million sir...
      You are a gem, genius

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

      @@Adeyeye_seyison sure Seyison, I’ll do the same.