LEFT Function in MSSQL and MySQL


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

MSSQL

Syntax:

LEFT(String, n)

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

Example:

select LEFT('This is demo',3)
----------------------
Thi

LEFT function in MSSQL

MySQL

It's similar to the MSSQL LEFT function.

Example:

mysql> select LEFT('This is demo',3);
+------------------------+
| LEFT('This is demo',3) |
+------------------------+
| Thi                    |
+------------------------+

LEFT Function in MySQL

Back to Converting Functions from MSSQL to MySQL