Тёмный

Rank and Dense Rank in SQL Server 

kudvenkat
Подписаться 835 тыс.
Просмотров 240 тыс.
50% 1

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 80   
@krzysztofs8535
@krzysztofs8535 7 лет назад
Venkat rules! I'm the biggest fan of your tutorials. You are the best teacher in the world. God bless you for all your work and achievements. I learned a lot from your videos. Your explanations are fantastic and the way of your teaching is superb. Greatings from Poland !
@88spaces
@88spaces 5 лет назад
I have said this before about you, but it bears repeating. You are the foremost expert on grouping data. I appreciate your videos and they have helped me a lot.
@chetanchaudhari7538
@chetanchaudhari7538 Год назад
Hi Venkat, I wanted to take a moment to express my heartfelt gratitude for your exceptional teaching of programming. Your dedication and expertise have had a tremendous impact on my learning journey, and I am incredibly grateful for your guidance. Your ability to break down complex programming concepts into understandable chunks truly impressed me. Through your clear explanations and engaging teaching style, you made learning programming enjoyable and accessible.
@poorvi1036
@poorvi1036 8 лет назад
Thank you for all your tutorials..I love your explanations and your soothing voice.I wish I had your brain,you make it look so easy,lol.
@rajreddy2561
@rajreddy2561 7 лет назад
Great explanation. One of the very few tutorials I have seen which is very clear and still very precise. Super job! Thanks Venkat
@srujanareddy5185
@srujanareddy5185 4 года назад
Omg...you are an amazing teacher. I feel too bad about not finding your tutorials until now. THANK YOU!
@Csharp-video-tutorialsBlogspot
@Csharp-video-tutorialsBlogspot 4 года назад
Hello Srujana - Thank you. Glad you are finding the videos useful. Means a lot. I have included all the SQL Course videos, slides and text articles in sequence on the following page. Hope you will find it handy. www.pragimtech.com/courses/sql-server-tutorial-for-beginners/ If you have time, can you please leave your rating and valuable feedback on the reviews tab. It really helps us. Thank you. Good luck and all the very best with everything you are doing.
@dhamma1283
@dhamma1283 3 года назад
Everytime I watch venkat tutorials, I like the video first and then I start. 👍
@gurjeet333
@gurjeet333 2 года назад
Although this is an old video the explanation is a real gem. Timeless knowledge
@shradarai1068
@shradarai1068 Год назад
That voice is ASMR to my ears.😌
@sumaiyamohiyuddin8173
@sumaiyamohiyuddin8173 4 года назад
Thanks a lot for ur explanation.The highlight is the clarity and simplicity of explanation
@awengirr
@awengirr 7 лет назад
This was the best explanation ever. Thank you for that!
@deepakpangali1315
@deepakpangali1315 2 года назад
Super awesome, your explanations are truly good. I really learnt a lot from it....Thank you so much!!
@TheHimaBindu
@TheHimaBindu 9 лет назад
Very informative
@absneo247
@absneo247 7 лет назад
Thanks very much for these videos.They are simple to understand and really helpful in learning query writing.
@samirkumar6180
@samirkumar6180 3 года назад
Hello sir, pls make video on table partitioning and their concept...this is something important which is not made yet
@pavithravvenu5817
@pavithravvenu5817 3 года назад
Great Videos and clear Explanation.Thanks a lot!!! it is very useful
@vishnuvardhanreddy5986
@vishnuvardhanreddy5986 Год назад
Nice Explanation, Thankyou so much.
@mscreations183
@mscreations183 5 лет назад
Awesome teaching...👌👌👌
@lilarasekh3818
@lilarasekh3818 7 лет назад
you guys are great! I learned a lot from your videos
@muhammadrehbarsheikh8498
@muhammadrehbarsheikh8498 9 лет назад
Thanks venkat sir!!
@anish_k
@anish_k 2 года назад
Thanka a lot sir
@nagatmohamed8246
@nagatmohamed8246 8 лет назад
Thanks a lot, sir.
@swetapanigrahi8001
@swetapanigrahi8001 4 года назад
Thank you.. Very nice tutorial
@optimistic_guy313
@optimistic_guy313 2 года назад
Thank you so much
@102RC
@102RC 7 лет назад
Thank You Professor.
@yogeshghule5260
@yogeshghule5260 6 лет назад
you are the great sir
@anirbandas2062
@anirbandas2062 6 лет назад
I have a problem, where i am required to determine a Rank on a table on the basis of a derived column. Say first column desired is Name of Port, 2nd column is the sum of profit made on that port. The third column should be the rank based on the highest profit the port has. How can i create an sql query of rank on a derived column like the sum of total profit for each port? Hopefully you can give a suitable example.
@prashantparmar1397
@prashantparmar1397 9 лет назад
Please post video on how to populate calender
@wwewwf324
@wwewwf324 5 лет назад
what is the use case of Rank function.Is there any scenario where we will use Rank?
@keyvansadeghi5743
@keyvansadeghi5743 4 года назад
Thank u bro that was helpful
@surabhichouhan3758
@surabhichouhan3758 4 года назад
Hi Can we use rank, dense_rank or row_number functions over varchar columns?
@analytikmindz5390
@analytikmindz5390 3 года назад
Yes
@dbin805
@dbin805 8 лет назад
thanks. this is the best explanation that I have seen for this.
@Csharp-video-tutorialsBlogspot
+Dean Brandenburg Thanks a bunch for taking your valuable time to give feedback. Means a lot. Glad you found the videos useful. Dot Net & SQL Server videos for aspiring software developers ru-vid.complaylists?view=1&sort=dd If you need videos for offline viewing, you can order them using the link below www.pragimtech.com/Order.aspx Code Samples, Text Version of the videos & PPTS on my blog csharp-video-tutorials.blogspot.com Tips to effectively use our channel ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-y780MwhY70s.html Want to receive email alerts, when new videos are uploaded, please subscribe to our channel using the link below ru-vid.com Please click the THUMBS UP button below the video, if you think you liked them Thank you for sharing these links with your friends Best Venkat
@raqibul1000
@raqibul1000 9 лет назад
Thanks a trillion
@richardfrimpong3962
@richardfrimpong3962 2 года назад
Why is it desc because I see the values in Ascending order so can someone give me why?
@praburajiiv
@praburajiiv 2 года назад
clean
@quanhoang2139
@quanhoang2139 8 лет назад
thanks you
@rameshr5809
@rameshr5809 6 лет назад
Hello Venkat, you are my Dhronacharya,Thanks lot. Why we need to use top 1 in Result when we are filtering with Dense_Rank?
@MaheshBabu-vq7qk
@MaheshBabu-vq7qk 4 года назад
If we have 3 employees with second highest paid salary, we will get Salary three times in the result CTE. In order to avoid such kind of duplicate salaries, we can use either "top 1" or "distinct" keyword in the final select query.
@krishnachaitanya9367
@krishnachaitanya9367 9 лет назад
Hi Venkat, Am very happy to see your videos. i have a small doubt in this video with the below query. with Result as ( select salary, RANK() over (order by salary desc) as salaryrank from [dbo].[dense_employees] ) SELECT TOP 1 salary from Result where salaryrank=1 and my table structure is: CREATE TABLE [dbo].[dense_employees]( [id] [int] NULL, [name] [varchar](30) NULL, [gender] [varchar](10) NULL, [salary] [int] NULL ) ON [PRIMARY] when am executing the above query in 2012 sql server its not giving output.its showing that "incorrect syntax near result". Please guide me how to execute this in 2012 sqlserver. it will be great if can you can help on this. when am browsing the internet some sites showing "with result sets" other than "with result as" Please guide me on this . Thnaks, Krishna
@drallisimo34
@drallisimo34 7 лет назад
coooooooool tutorial!!!
@adithyagarigipati4205
@adithyagarigipati4205 5 лет назад
Can we start rank from a number we need ? Like 1000 ?
@shivarjunroy1394
@shivarjunroy1394 4 года назад
Rank will omit whereas dense rank will not omit
@maryam4071
@maryam4071 5 лет назад
What’s tie? I can’t understand it.
@nys8260
@nys8260 3 года назад
notice in salary column there is two values 8000 this is called tie (when there is more one value is similar)
@gurungoracle
@gurungoracle 8 лет назад
how can I rank whole record only 1 through 10? not top n
@ManishKumar-qx1kh
@ManishKumar-qx1kh 3 года назад
use a CTE to rank them first and then select from the CTE where rank between to
@shivarjunroy1394
@shivarjunroy1394 4 года назад
Mechanical
@shivarjunroy1394
@shivarjunroy1394 4 года назад
Madhuri Dixit
@shivarjunroy1394
@shivarjunroy1394 4 года назад
Anil Kapoor
@saahilsud8933
@saahilsud8933 4 года назад
What is with this fake accent man? It makes it so hard to focus on the lesson without getting irritated out of your mind. Who are you? Priyanka Chopra?
@shaikhzoyeb
@shaikhzoyeb 3 года назад
declare @tbl table ( id int ) insert into @tbl values (1),(1),(3),(4),(5) select rank() over (order by id) as Rank_, DENSE_RANK()over (order by id) as Dense_rank_ from @tbl
@liverickoben9922
@liverickoben9922 4 года назад
thanks for all your tutorials and clear explanations
@fikirtezewdie5633
@fikirtezewdie5633 2 года назад
Hi Venkat, you are the best!!
@bhavyashreesarvamangala6775
@bhavyashreesarvamangala6775 3 года назад
Super super super duper
@alinemath5030
@alinemath5030 7 месяцев назад
Thanks!
@jsj14
@jsj14 3 года назад
What if there are 100Million rows in this table? Won't the order by take a lot of time while ranking
@aadityasharma9024
@aadityasharma9024 3 года назад
When you use Top 1 then it should be returning 1st row then what's the use of where clause with it?
@mariorivera6292
@mariorivera6292 2 года назад
This helped me understand Rank better. Thank you.
@praveennagarajan1407
@praveennagarajan1407 3 года назад
Hi, How can I select top 3 of DENSE_RANK() ?
@TheSwatirock
@TheSwatirock 7 лет назад
Thanks Professor..tutorial is quite helpful.
@soniasadeque4248
@soniasadeque4248 7 лет назад
hats off to you.. you are a great teacher..
@shariqahmed9416
@shariqahmed9416 5 лет назад
Nice explanation skills
@supercatsmari
@supercatsmari 5 лет назад
Thank you Venkat. I need some more information on this with join condition. Example i have employee table which has eno,ename,esal,edeptno columns, and another table (dept) which has dno,dname. Now i want to get the second max salary of "dname='Maths'". Please help me on this.
@MaheshBabu-vq7qk
@MaheshBabu-vq7qk 4 года назад
With EmployeeCTE as ( select emp.Name as [Employee Name], Gender, Salary, dept.Name as [Department Name], Dense_Rank() over (partition by dept.Name order by Salary desc) DenseRank from tblEmployees emp inner join tblDepartment dept on emp.DepartmentId = dept.DepartmentId ) Select Salary from EmployeeCTE where DenseRank = 2 and [Department Name]='Maths' With the above inner query in EmployeeCTE, we will get all the employee details like Employee Name, Gender, Salary, Department Name and Dense Rank partitioned by each department. Finally, we are getting second highest paid salary for the department "Maths" from the EmployeeCTE.
@shivarjunroy1394
@shivarjunroy1394 4 года назад
Ritesh Deshmukh
@annwayde129
@annwayde129 4 года назад
Thanks a lot
@jorgegonzaloalfaro5378
@jorgegonzaloalfaro5378 4 года назад
Bro thank you!!!!
@chandrakumarreddyvennapusa7806
@chandrakumarreddyvennapusa7806 3 года назад
Fantastic
@ting-kangpai1580
@ting-kangpai1580 4 года назад
Thank you!
@shivarjunroy1394
@shivarjunroy1394 4 года назад
Rank =1
@korrapativinodkumar4760
@korrapativinodkumar4760 6 лет назад
EXCELLENT
@JohnDoe-dy4kf
@JohnDoe-dy4kf 7 лет назад
What are the advantages using of Rank() compared to GROUP BY or DISTINCT?
@ManishKumar-qx1kh
@ManishKumar-qx1kh 3 года назад
u cant group by for each record brother there will be only one record for each group. Rank with Over clause will give you each record separately.
@Gamezone-kq5sx
@Gamezone-kq5sx 6 лет назад
want to find tob 5 highest product price in each category.In this case if there are one or more products with same price and if I use rank() then I get more than two record with rank 1 but I can't get rank with value 2 because there is tie.But in this case if I use dense_rank() then I get more than one records with dense_rank() of value 1 2 3 4 5.Please help
@aaron2cool4u
@aaron2cool4u 2 года назад
Try select distinct rather than regular select with rank()
@AmitKumar-fr7gb
@AmitKumar-fr7gb 2 года назад
@@aaron2cool4u Thanks.. I had the same question.
Далее
Дикий Бармалей разозлил всех!
01:00
Row Number function in SQL Server
7:24
Просмотров 239 тыс.
Over clause in SQL Server
9:13
Просмотров 240 тыс.
Window functions in SQL Server
11:00
Просмотров 220 тыс.
Scalar user defined functions in sql server   Part 30
19:07
SQL Ranking Functions: Part 1 The Over Clause
8:51
Просмотров 31 тыс.