How to truncate the text returned for a column in a MySQL query

select id, SUBSTRING(full_name,1, 32), age FROM user 

select id, SUBSTRING(full_name,1, 32), age FROM user

Quoting mysql.com:

For all forms of SUBSTRING(), the position of the first character in the string from which the substring is to be extracted is reckoned as 1.


select id, SUBSTR(full_name, 1, 32), age FROM user;

OR

select id, SUBSTRING(full_name, 1, 32), age FROM user;

OR

select id, SUBSTRING(full_name, FROM 1 FOR 32), age FROM user

Note: SUBSTR() is a synonym for SUBSTRING().

found on mysql doc

Tags:

Mysql

Sql