Articles → SQL SERVER → First_Value Function In The SQL Server

First_Value Function In The SQL Server






Purpose





Example




Picture showing the sample data in the database table
Click to Enlarge



SELECT
   id,
   [state],
   [Difference],
   FIRST_VALUE([Difference]) OVER (ORDER BY [Difference] ASC) AS [Lowest Difference]
FROM
   population



Output


Picture showing the output of First_Value Function In The SQL Server
Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Sunday, April 23, 2023

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250