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
SQL Query script for your reference:
drive.google.com/file/d/1ffb1mRHuPzoHPTisDFwXXX9p5lbzyHLP/view?usp=share_link
Thanks a million sir,
Mr Jain Akitant...
Thanks for all you do and represents...
You’re most welcome, seyison!
Super 👌 Bhai you must keep posting advance SQL, slow and steady progress.
God Bless and meditate daily 🙏
Thank you Shiv for your kind words. Let me know if you need any particular kind of assistance in SQL.
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
Superb performance❤ Thanks a lot. Can you make a video for using trigger in sql and views please🙏
Thanks for your kind words Satish. Yes I’ll definitely make those videos soon.
@@analyticalguy thanks a lot for considering it.
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.
How to do the same in workbench? When comparing null and sales it shows null is less than sales and the flag is 0
Where is sql script?
drive.google.com/file/d/1ffb1mRHuPzoHPTisDFwXXX9p5lbzyHLP/view?usp=share_link
Would it be rude to ask for your email address
Hi, my email id is analyticalguys@gmail.com
Thanks a million sir,
Mr Jain Akitant...
Thanks for all you do and represents...
You’re welcome. Let me know what else I can help you with :)
@@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
@@Adeyeye_seyison sure Seyison, I’ll do the same.