SPACE() function in MySQL is used to return a string consisting of specified empty space characters.
Syntax :
Example-2 : Applying SPACE() Function with CONCAT() Function return a string.
Example-3 : Using SPACE() Function in a Table.
Table : Player_Details :
SPACE(num)Parameter : This method accepts one parameter as mentioned above and described below :
- num : It is an integer which indicates how many spaces are being contained.
SELECT SPACE(6) AS String_Name;Output :
| String_Name |
|---|
SELECT CONCAT('Geeks', SPACE(3), 'For', SPACE(3), 'Geeks') AS Company_Name;
Output :
| Company_Name |
|---|
| Geeks For Geeks |
| Player_Id | First_Name | Last_Name |
|---|---|---|
| 101 | Virat | Kohli |
| 102 | Rohit | Sharma |
| 103 | Sikhar | Dhawan |
SELECT CONCAT(First_Name, SPACE(3), Last_Name) AS Full_Name FROM Player_Details ;Output :
| Full_Name |
|---|
| Virat Kohli |
| Rohit Sharma |
| Sikhar Dhawan |