SPACE to add space in Query

MySQL SPACE
SPACE Query takes integer N as argument.
SELECT SPACE (15)
We can add one start and end string to display the space between them
SELECT  '#', SPACE( 15 ) ,  '#' // Output   #	             	#
We can use SPACE with our student table
SELECT  name , SPACE(10), class , mark, sex  FROM `student`
nameSPACE(10)classmarksex
John Deo Four75female
Max Ruin Three85male
Arnold Three100male
Krish Star Four60female
John Mike Four60female
Alex John Four55male

SPACE with UPDATE Query

We can add blank space to data in a Column by using update query
UPDATE student set name=CONCAT(space(5),name)
We added space before all names in our student table.

CONCAT to add string

Removing Space

To remove space from Left we can use LTRIM, to remove space from Right we can use RTRIM and to remove from both sides we can use TRIM

Rread more on UPDATE Query




Subscribe to our mailing list

* indicates required
Subscribe to plus2net
Your Rating


Google+

Post Comment This is for short comments only. Use the forum for more discussions.




Subscribe to our mailing list

* indicates required
Subscribe to plus2net




HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2017 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer