SQL Value Window Function

This Window function operates on a set of rows for the query provided. It returns the value for each row using multiple rows or only one row. The set of the row is determined by the OVER() clause. These functions are used to find out the first value, last value, next value, and previous value in the set of rows. These value window functions are also known as Analytic Window functions.

The below table list shows the different types of  Value Window functions with their argument type and description –

Window Function Argument Type Return Type Description
LAG() Any supported Drill data types Same as the expression type The LAG() window function is used to fetch the previous row data along with the current row data.
LEAD() Any supported Drill data types Same as the expression type The LEAD()window function is used to fetch the subsequent row data along with the current row data. If no row exists, null is returned.
FIRST_VALUE Any supported Drill data types Same as the expression type The FIRST_VALUE window function returns the value the first value from the specified column with the current row in the dataset.
LAST_VALUE Any supported Drill data types Same as the expression type The LAST_VALUE window function returns the value the last value from the specified column with the current row in the dataset.

These are the main four value window function that is used in SQL. Let’s look at the other articles to get an in-depth understanding of these functions using different explanatory examples.

 

Other SQL topics to check out:

Follow us on TwitterFacebookLinkedin, and Tableau Public to stay updated with our latest blog and what’s new in Tableau.

Automate data analysis pipeline and create report ready dashboards

If you are looking forward to getting your data pipeline built and setting up the dashboard for business intelligence, book a call now from here.

Established in 2020, Lets Viz Technologies provides a full range of high-quality data analysis and data visualization services. We are also an authorized Zoho Partner.

 

Contact

WeWork Berger Delhi One, C-001/A2, Sector 16B, Noida, Uttar Pradesh 201301

0124-502-5592
info@lets-viz.com

We are Social

Trust Pilot Reviews