You can use the group by group value one column, and if you want, you can calculate the column. A grouping column that uses features such as COUNT,SUM,AVG.
The table that you want to know about the employee_tbl of the GROUP BY clause has the following records:
Mysql> SELECT * from EMPLOYEE_TBL;
+------+------+------------+--------------------+
| id | name | work_date | daily_typing_pages
| +------+------+------------+--------------------+
| 1 | John | 2007-01-24 | The |
| 2 | Ram | 2007-05-27 | The |
| 3 | Jack | 2007-05-06 | 170 |
| 3 | Jack | 2007-04-06 | |
| 4 | Jill | 2007-04-06 | The |
| 5 | Zara | 2007-06-06 | A |
| 5 | Zara | 2007-02-06 | |
+------+------+------------+--------------------+
7 rows in Set (0.00 sec)
Now, let's say that based on the table above, we want to calculate the number of days each employee works.
If we are going to write an SQL query, as shown below, we will get the following result:
Mysql> SELECT COUNT (*) from EMPLOYEE_TBL;
+---------------------------+
| COUNT (*) |
+---------------------------+
| 7 |
+---------------------------+
However, this is not our purpose service and we want to display the total number of individual pages entered for each person. This is done by using the aggregate function with the GROUP BY clause as follows:
mysql> SELECT Name, COUNT (*)
-> from employee_tbl
-> GROUP by name;
+------+----------+
| name | COUNT (*) |
+------+----------+
| Jack | 2 |
| Jill | 1 |
| John | 1 |
| Ram | 1 |
| Zara | 2 |
+------+----------+
5 rows in Set (0.04 sec)