Group by always used when there is any aggregate function like count.
Here is a small program to understand the logic for group by
SELECT empl_stat_cd , prsn_intn_id , count (prsn_intn_id)
GROUP BY empl_stat_cd , prsn_intn_id
It will check that how many times prsn_intn_id is present in the column for the group of empl_stat_cd , prsn_intn_id.
After writing group we
need to write the entire column name whatever we need to fetch from select
If we don’t use group by then it is not possible to count error will come. In the above example if we put two column under select then count function accordingly.