With CTE in SQL | Common Table Expression | Find nth Max Salary in SQL
HTML-код
- Опубликовано: 16 окт 2024
- With CTE in SQL | Common Table Expression | Find nth Max Salary in SQL
Blog - www.testerhoon.com
Explained -
Syntax
-Usage
-example to find out nth max salary number
#sql
#etltesting
Awesome!! Excellent explanation thank you.
Thankyou for this informative video, explained in very clear and simple way. Thanks
😊👍
Great work Miss👍
thank you 🙏
Keep doing good work
Very informative thanks for sharing such a video. Please make video on real time ETL tool.
sure, thanks for watching 🙏
Very informative content..👍
Ma'am, please Azure Data k basic bhi btye..
okay 👍
Please bring more lecture videos asap
sure . 👍
Hello Mam,
What if we have the same salary for 3 persons/ids ?
then all will fall under the same rank.. 🙏
If there is a duplicate records in salary column then how it will work???
in that case use dense_rank() function 🙏
I don't know why but I feel this is wrong bcoz I always used dense_rank() if there r duplicate records that condition if we r used row_number then v get wrong output
this i have used for my test data with 5 records and all having different salary... u could use dense rank if u have multiple same salary... 🙏
Here, we have to hardcode the count value of row number to get the nth salary, is there a way to make this query more dynamic?
you could copy that code and make stored procedure and pass as a variable..
How to use Row Number when we have duplicate or same salary numbers.
in that case u could use dense rank instead of row number...
Mam in how many we can be perfect in SQL
Practice Practice and practice... thats the only way to bcm perfect 🙏✌
ma'am i think this is a wrong function you used.
for nth max salary we use dense_rank()
beacuse if the salary is duplicate then how row_number() works?
you didn't take duplicate salary thats why the ans is showing right..
but i said this is wrong..
ma'am please correct me if i am wrong...🙏
in the given example no duplicate data i took hence used it..... if there are duplicate u have to use dense_rank...
You can do it simply but why did you use cte for that
yes, we can do it.. just to explain the CTE i have used it.. m🙏
i am asking difference between cte for simply query
@@gauravsingh8274 CTE we use to store a resultset that we can use further in the query... its up to u... u could use it anywhere as per ur need..
@@testerhoon28 ok waiting you videos
Now a days interviewers ask very complex query what can I do now
that comes from practice... the more u practice on real scenerios .. the more u get expertize on sql.. 🙏
It's not desc order maam
you can either use Describe or Desc
can you please share ur LinkedIn?
I do not have LinkedIn account... 🙏
@@testerhoon28 Can you please refer me in IBM for Azure data engineer role?
@@akshaydudhe9395 pls share ur resume at tmadamji@gmail.com
@@testerhoon28 yes sent