Check out example codes for "group by sql". It will help you in understanding the concepts better.

Code Example 1

# Use SQL Group By clause after the Where clause
# Any column in the select list must either be in the Group By clause 
# or part of an agregation statement
# Multiple columns can be included in the Group By Clause seperated by a comma
# Multiple columns stipulate the order tree. Order by 
# first column, then second ... etc

Select LastName, FirstName, Sum(LeaveDays), Max(age)
From EmployeeProjects
Where StartDate > '2020-01-01'
Group By LastName, FirstName

Code Example 2

SELECT column_name(s)
  FROM table_name
  WHERE condition
  GROUP BY column_name(s)
  HAVING condition
  ORDER BY column_name(s);

Code Example 3

SELECT `gender` FROM `members` GROUP BY `gender`;

Code Example 4

SELECT <field1, field2, field3…>
FROM <table1_name>
WHERE <condition/expression>
GROUP BY <field1, field2, field3…>

Learn ReactJs, React Native from