Database.Guide

Skip to content

Beginners

  • What is a Database?
  • Database Tutorial

SQL

  • SQL Tutorial
  • SQL Reference
  • SQL Joins Tutorial
  • SQL Transactions Tutorial
  • Basic SQL Queries

Categories

  • Azure SQL Edge (17)
  • Database Concepts (99)
  • Database Tools (72)
  • DBMS (9)
  • DuckDB (125)
  • MariaDB (424)
  • Microsoft Access (17)
  • MongoDB (265)
  • MySQL (602)
  • NoSQL (8)
  • Oracle (301)
  • PostgreSQL (480)
  • Redis (210)
  • SQL (697)
  • SQL Server (1,169)
  • SQLite (298)

Tag: functions

2 Functions that Validate JSON Documents against their Schemas in MySQL

Posted on September 2, 2023September 2, 2023 by Ian

MySQL 8.0.17 introduced a couple of functions that allow us to validate JSON documents against their schemas. These are listed below, with examples.

Continue reading →
MySQL functions, how to, json

Overview of the CUME_DIST() Function in SQL Server

Posted on August 31, 2023September 5, 2023 by Ian

In SQL Server, the CUME_DIST() function calculates and returns the cumulative distribution of a value within a group of values. This is the relative position of a specified value in a group of values.

Continue reading →
SQL Server functions, t-sql, what is, window functions

List of MySQL Window Functions

Posted on August 30, 2023August 30, 2023 by Ian

Below is a list of functions that can be used as window functions in MySQL.

Some are nonaggregate functions that can only be used as window functions, while others are aggregate functions that can be used as window functions if required.

Continue reading →
MySQL functions, reference, window functions

Using the LEAD() Function to Get a Value from a Later Row in PostgreSQL

Posted on August 29, 2023August 29, 2023 by Ian

In PostgreSQL the lead() function returns the value from a subsequent row to the current row, specified by the given offset.

The offset specifies how many rows after the current row to get the value from. For example, an offset of 1 gets the value from the next row.

Continue reading →
PostgreSQL functions, how to, what is, window functions

Using the LAG() Function to Get a Value from a Previous Row in PostgreSQL

Posted on August 28, 2023 by Ian

In PostgreSQL the lag() function returns the value from a previous row, specified by the given offset.

The offset specifies how many rows prior to the current row to get the value from. For example, an offset of 1 gets the value from the previous row.

Continue reading →
PostgreSQL functions, how to, what is, window functions

Understanding the NTH_VALUE() Function in PostgreSQL

Posted on August 27, 2023August 27, 2023 by Ian

In PostgreSQL the nth_value() function is a window function that returns the value from the given row of the current window frame. We provide the column and row number as an argument when we call the function.

Continue reading →
PostgreSQL functions, how to, what is, window functions

Using the CUME_DIST() Function to Get the Cumulative Distribution in PostgreSQL

Posted on August 26, 2023September 10, 2024 by Ian

In PostgreSQL, we can use the cume_dist() function to return the cumulative distribution of a value within a group of values.

It calculates this as follows: (the number of partition rows preceding or peers with current row) / (total partition rows).

The return value ranges from 1/N to 1.

Continue reading →
PostgreSQL functions, how to, what is, window functions

Overview of the PERCENT_RANK() Function in PostgreSQL

Posted on August 25, 2023September 10, 2024 by Ian

In PostgreSQL, we can use the percent_rank() function to return the relative rank of each row, expressed as a percentage ranging from 0 to 1 inclusive.

Continue reading →
PostgreSQL functions, how to, what is, window functions

Using the NTILE() Function to Divide a Partition into Buckets in PostgreSQL

Posted on August 24, 2023August 24, 2023 by Ian

In PostgreSQL, the ntile() function is a window function that divides a partition into the specified number of groups (buckets), distributing the rows as equally as possible, and returns the bucket number of the current row within its partition.

Continue reading →
PostgreSQL functions, how to, what is, window functions

Understanding the DENSE_RANK() Function in PostgreSQL

Posted on August 21, 2023August 21, 2023 by Ian

PostgreSQL has a window function called dense_rank() that returns the rank of the current row, without gaps.

It works the same way that the rank() function works, but without gaps (the rank() function includes gaps).

Continue reading →
PostgreSQL functions, how to, what is, window functions
  • «
  • 1
  • …
  • 24
  • 25
  • 26
  • 27
  • 28
  • …
  • 145
  • »

About Database.Guide | Privacy Policy