As you go about examining and analysing data of varying magnitudes, you will quickly realise the need for grouping similar types of values together and looking at them as one group. For example, consider a table that has data, which consists of the marks scored by students in their 12th board exams. While you would want to know how the students performed in all the subjects put together, it is equally important to see how they performed in each subject. You can derive even further insights if you group these students by state. Hence, it is imperative that you learn the usage of aggregate functions in your queries. So, let’s go ahead and learn about it from our expert in the upcoming video.

2479616

So, in this segment, you learnt how to use the **group by** clause. In brief, we use ‘group by’ when we need to find the aggregate values of a columnC1 ‘grouped by’ a certain column C2.

**count()** is just one of many aggregate functions that are available in the MySQL Workbench. Feel free to explore other functions, such as **min()**, **max()** and **avg()**. Try using them in queries and examine the results that you obtain. You will realise that aggregate functions play a crucial role in determining outliers in the data and analysing any existing trends in it.

2479616

So, as Professor Ramanathan mentioned in the video, please keep this in mind whenever you write any query because not all versions of the MySQL Workbench in all operating systems allow non-aggregate columns in the ‘select’ clause whenever you use a ‘group by’ statement.

Now based on the above learnings, let’s try to solve the below MCQs.

You can refer to the link given below to learn more about some other types of aggregate functions that are used in MySQL:

Now, let’s try to solve the following coding question.

Write a query to retrieve the total number of employees, do the aliasing of count as totalEmployees.

In this way, you have learnt about the various aggregate functions in this segment. In the next segment, you will learn about another operation i.e. Ordering.