MariaDB: RIGHT Function
This MariaDB tutorial explains how to use the MariaDB RIGHT function with syntax and examples.
Description
The MariaDB RIGHT function allows you to extract a substring from a string, starting from the right-most character.
Syntax
The syntax for the RIGHT function in MariaDB is:
RIGHT( string, number_of_characters )
Parameters or Arguments
- string
- The string that you wish to extract from.
- number_of_characters
- The number of characters that you wish to extract from string starting from the right-most character.
Note
- If number_of_characters exceeds the length of string, the RIGHT function will return string.
Applies To
The RIGHT function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB RIGHT function examples and explore how to use the RIGHT function in MariaDB.
For example:
SELECT RIGHT('TechOnTheNet.com', 1); Result: 'm' SELECT RIGHT('TechOnTheNet.com', 4); Result: '.com' SELECT RIGHT('TechOnTheNet.com', 6); Result: 'et.com' SELECT RIGHT('TechOnTheNet.com', 99); Result: 'TechOnTheNet.com'
Advertisements