Computer >> Computer tutorials >  >> Programming >> MySQL

How can I use SPACE() function along with MySQL’s column data?


MySQL table’s column name can be used along with SPACE() function to add white spaces between two column, after or before a specified column. Following the example from the data of ‘Student’ table is used to demonstrate it.

Example

mysql> Select Id, Space(8),Name from Student;
+------+----------+---------+
| Id   | Space(8) | Name    |
+------+----------+---------+
| 1    |          | Gaurav  |
| 2    |          | Aarav   |
| 15   |          | Harshit |
| 20   |          | Gaurav  |
| 21   |          | Yashraj |
+------+----------+---------+
5 rows in set (0.00 sec)

In the above example, 8 white spaces have been added as a column between two columns.