w3resource

PostgreSQL REVERSE() function


REVERSE() function

The PostgreSQL reverse() function is used to arrange a string in reverse order.


Uses of REVERSE() Function

  • String Manipulation: Reverse the order of characters in a string.

  • Text Processing: Useful for palindromes or when analyzing text patterns.

  • Data Transformation: Transform strings for specific formatting or data presentation needs.

  • Algorithm Implementation: Implement algorithms that require reversed string logic.

Syntax:

reverse(<string>)

PostgreSQL Version: 9.3

Visual Presentation of PostgreSQL REVERSE() function

Pictorial presentation of postgresql reverse function


Example: PostgreSQL reverse() function:

In the example below, the string 'w3resource' have arranged in reverse order.

SQL Code:

SELECT reverse('w3resource');

Output:

  reverse
------------
 ecruoser3w
(1 row)

Previous: RIGHT function
Next: Date and Time Operators



Follow us on Facebook and Twitter for latest update.