Generate a string consisting of a specified number of spaces.
SPACE ( <len> )
| Parameter | Description |
|---|---|
<len> | The number of spaces to generate |
Returns a string consisting of the specified number of spaces. Special cases:
<len> is less than 0, an empty string is returned.SELECT space(5);
+----------+ | space(5) | +----------+ | | +----------+
SELECT space(0), space(-5);
+----------+-----------+ | space(0) | space(-5) | +----------+-----------+ | | | +----------+-----------+
SELECT space(NULL);
+-------------+ | space(NULL) | +-------------+ | NULL | +-------------+
SELECT CONCAT('Hello', space(3), 'World');
+------------------------------------+ | concat('Hello', space(3), 'World') | +------------------------------------+ | Hello World | +------------------------------------+
SPACE