Site icon TestingDocs.com

MySQL LEFT Function

Overview

In this tutorial, we will learn about MySQL LEFT function with an example. The function returns the leftmost length of characters from the string.

Syntax

The general syntax of the function is as follows:

LEFT(string,length)

Example

mysql> SELECT LEFT(‘TestingDocs’,4);
+———————–+
| LEFT(‘TestingDocs’,4) |
+———————–+
| Test |
+———————–+
1 row in set (0.00 sec)

mysql> SELECT LEFT(NULL,4);
+—————————-+
| LEFT(NULL,4) |
+—————————-+
| NULL |
+—————————-+
1 row in set (0.00 sec)

 

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Exit mobile version