The GROUP BY statement is used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result set by one or more columns.
SELECT column_name FROM table_name GROUP BY column_name; or SELECT column_name1,column_name2 FROM table_name GROUP BY column_name1,column_name2;
Query to show only department name:
SELECT Department FROM employees GROUP BY Department;
Query to show department and designation name:
SELECT Department,Designation FROM employees GROUP BY Department,Designation;