Q:

Digit grouping of mysql query result

I have MYSQL query
mysql --batch --disable-column-names -uroot -pXXXXXX --database data -e 'SELECT COUNT(*) FROM table.name' ;

what gives me a result
6878387

Is it possible to have the same output with digit grouping like
6 878 387

A:

Combination of FORMAT and REPLACE would give you desired result
select replace(format(count(*),0),',',' ') from table.name

