'Formatting MySQL output in online IDE

Test platform Used - HackerRank | MySQL/MSSQL

Recently attempted an code assessment for a job post involving SQL questions. I was able to get the correct output for the problem statement but the required output was formatted in a tabular format - tabs between values.

    val1    val2    val3
    val4    val5    val6

Only way I know how to achieve something similar is by using mysql -t or --table commands, none of which could be used there.

Code was in the simple query format

     *cte declaration*
     select col1, avg(col2), avg(col3), sum(col4)
     from cte
     group by col1
     ; (or GO)     /*end of query*/

Has anyone come across a similar issue? I would love some help regarding this.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source