SPACE Function - SQL


Overview


The SPACE function in SQL returns a string of repeated spaces. It is useful for formatting or padding output.

Example:

SELECT SPACE(5)

Syntax:

SELECT SPACE(num_of_spaces)

num_of_spaces is the number of spaces you want in the returned string.


Example: Hard-coded value


In this example, we are returning 5 blank spaces in the output.