Introduction
In this article, I will explain the use of the Ranking function in Microsoft SQL Server. In common use, Rank shows the position and courage of a person in a real life scenario. So here, I will also give some examples related to all Ranking functions in Microsoft SQL Server.
Table in Microsoft SQL Server
My table contains bulk amount of data and it’s related to student marks list. So, I am going to apply Microsoft SQL Server Ranking function in the following Table “Table_MarkList”.
SQL Query
- USE [Test]
- GO
- /****** Object: Table [dbo].[Table_MarkList] Script Date: 08/03/2016 12:06:32 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- SET ANSI_PADDING ON
- GO
- CREATE TABLE [dbo].[Table_MarkList](
- [Id] [int] IDENTITY(1000,1) NOT NULL,
- [Name] [varchar](50) NULL,
- [Marks] [int] NULL
- ) ON [PRIMARY]
- GO
- SET ANSI_PADDING OFF
- GO
- SET IDENTITY_INSERT [dbo].[Table_MarkList] ON
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1000, N'Vimal', 85)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1001, N'Nikhil', 85)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1002, N'Prasanth', 84)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1003, N'Manaf', 83)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1004, N'Naveen', 82)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1005, N'Midhun', 80)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1006, N'Vijeth', 95)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1007, N'Dileep', 97)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1008, N'Ashiq', 92)
- INSERT [dbo].[Table_MarkList] ([Id], [Name], [Marks]) VALUES (1009, N'Rajeesh', 75)
- SET IDENTITY_INSERT [dbo].[Table_MarkList] OFF
The following are the Ranking functions in Microsoft SQL Server.

Ano MepaniPosted Mar 23, 2019, 10:25 AM
Very well explained in detail with example
Fabio Silva LimaPosted Dec 22, 2016, 10:32 AM
Shooooooooooooooooooooooooooooooow thank you very much! awesome!
Srinivas KPosted Dec 22, 2016, 8:39 AM
Excellent explanation.............
Subhashkumar YadavPosted Dec 22, 2016, 5:04 AM
Nicely Explained............
sreenivasa kPosted Dec 21, 2016, 1:36 PM
Excellent and more worth reading