PostgreSQL – LENGTH Function

The LENGTH() function is used to retrieve the length (number of characters) of a string. It takes a string as an argument and returns an integer representing the length of the string.

The syntax of the LENGTH() function is as follows:

LENGTH(string)

where string is the input string for which you want to determine the length.

Here’s a simple example of how to use the LENGTH() function in PostgreSQL:

SELECT LENGTH('Hello, World!') AS string_length;

In this example, the LENGTH() function calculates the length of the string “Hello, World!” and returns the result, which would be 13.

Similar Posts