LEFT()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the requested number of leftmost characters in a string.
USAGE
LEFT(string, count)
Argument Name | Description |
---|---|
| The input string |
| The number of characters to return |
DETAILS
LEFT()
is a string function that returns the requested number of leftmost characters in the string argument.
If the count exceeds the length of the string, the entire string is returned without any padding.
A NULL
is returned if any argument is NULL
.
EXAMPLES
SELECT LEFT('MariaDB!', 5);
+---------------------+
| LEFT('MariaDB!', 5) |
+---------------------+
| Maria |
+---------------------+
SELECT QUOTE(LEFT('hi', 10));
+-----------------------+
| QUOTE(LEFT('hi', 10)) |
+-----------------------+
| 'hi' |
+-----------------------+