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 !
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.
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.
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.
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.
+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
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.
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
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?
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
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.
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.
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