In the following example you will see the how to use the MySQL by. Here, we will use GROUP BY clause. It displays the data in the group of employee salary. The GROUP BY statement is used with aggregate functions to group the result.
Query to select all data:
It displays the data as follow:
Query to use GROUP BY:
The above query sums the employee salary having same department name and shows it in one row. you get the following output: