PostgreSQL RIGHT() function
RIGHT() function
The PostgreSQL right() function is used to extract n number of characters specified in the argument from the right of a given string. When the value of n is negative, the extraction will happen from the right except for first n characters.
Syntax:
right(<string>,n)
PostgreSQL Version: 9.3
Pictorial Presentation of PostgreSQL RIGHT() function

Example 1: PostgreSQL RIGHT() function:
In the example below, the rightmost five characters from the string 'w3resource' have been extracted.
Code:
SELECT right('w3resource',5);
Sample Output:
right ------- ource (1 row)
Example 2:
In the example below, the right function extracted all the characters from the right side except 3 leftmost characters from the string 'w3resource', because the value of extracting character number is negative.
Code:
SELECT right('w3resource',-3);
Sample Output:
right --------- esource (1 row)
Previous: TRANSLATE function
Next: REVERSE function
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook