RIGHT Function in MSSQL and MySQL


The RIGHT function returns the specified number of characters from the right of a given string. Its functionality is the same in both MSSQL and MySQL.

MSSQL

Syntax:

RIGHT(String, n)

Where string is the string to retrieve rightmost characters from, and n is the number of characters to retrieve.

Example:

select RIGHT('This is demo',3)
----------------------
emo

RIGHT Function in MSSQL

MySQL

It's similar to the MSSQL RIGHT function.

Example:

mysql> select RIGHT('This is demo',3);
+--------------------------+
| RIGHT('This is demo',3)  |
+--------------------------+
| emo                      |
+--------------------------+

RIGHT function example in MySQL

Back to Converting Functions from MSSQL to MySQL