SQL Server Ranking Functions – ROW_NUMBER, RANK, DENSE_RANK, NTILE

SQL ranking functions enable us to rank records in the table based on values of a field or multiple fields. Clause OVER() is mandatory for the ranking functions. Ranking functions belongs to the group of Window functions. Aggregate functions and Offset functions (for paging) also belong to this group. List of Ranking Functions ROW_NUMBER ()… Read More »

SQL ORDER BY – Sorting Data in SQL Table in Descending or Ascending Order

ORDER BY clause in SQL enables us to sort results of the query by specific field (column) or more columns. There are 2 sorting options: Ascending order (ASC) – sorts records from lowest to highest in case of numbers and from A to Z in case of text strings Descending order (DESC) – sorts records… Read More »

SQL OFFSET (Window) Functions – LAG, LEAD, FIRST_VALUE, LAST_VALUE

OFFSET functions are relatively new to MS SQL Server. They are available since SQL Server 2012 version. These functions enable a user to “list” through rows of a table. To be precise, it makes you able to put hand on previous or next row while still at the current one. These functions belong to a… Read More »

Excel | VLOOKUP vs HLOOKUP – What’s the Difference + Example

The VLOOKUP function is one of the most commonly used Excel functions in general. This function returns a value we are looking for from a particular column of a table containing many rows and columns. The function supports 2 modes – full and approximate match. In addition to the VLOOKUP function, there is a similar… Read More »