# Continuous learning in SQL

You've explored a lot about SQL, including applying filters to SQL queries and joining multiple tables together in a query. There's still more that you can do with SQL. This reading will explore an example of something new you can add to your SQL toolbox: aggregate functions. You'll then focus on how you can continue learning about this and other SQL topics on your own.

## Aggregate functions

In SQL, **aggregate functions** are functions that perform a calculation over multiple data points and return the result of the calculation. The actual data is not returned.

There are various aggregate functions that perform different calculations:

<div class="rc-CML" dir="auto" id="bkmrk-count-returns-a-sing"><div><div data-track="true" data-track-action="click" data-track-app="open_course_home" data-track-component="cml" data-track-page="item_layout" role="presentation"><div data-track="true" data-track-action="click" data-track-app="open_course_home" data-track-component="cml_link" data-track-page="item_layout"><div class="css-1k5v0wb" data-testid="cml-viewer">- <var>COUNT</var> returns a single number that represents the number of rows returned from your query.
- <var>AVG</var> returns a single number that represents the average of the numerical data in a column.
- <var>SUM</var> returns a single number that represents the sum of the numerical data in a column.

</div></div></div></div></div>### **Aggregate function syntax**

To use an aggregate function, place the keyword for it after the <var>SELECT</var> keyword, and then in parentheses, indicate the column you want to perform the calculation on.

For example, when working with the <var>customers</var> table, you can use aggregate functions to summarize important information about the table. If you want to find out how many customers there are in total, you can use the <var>COUNT</var> function on any column, and SQL will return the total number of records, excluding <var>NULL</var> values. You can run this query and explore its output:

---

```
SELECT COUNT(firstname)
FROM customers;
```

---

```
+------------------+
| COUNT(firstname) |
+------------------+
|               59 |
+------------------+
```

---

The result is a table with one column titled <var>COUNT(firstname)</var> and one row that indicates the count.

If you want to find the number of customers from a specific country, you can add a filter to your query:

---

```
SELECT COUNT(firstname)
FROM customers
WHERE country = 'USA';
```

---

```
+------------------+
| COUNT(firstname) |
+------------------+
|               13 |
+------------------+
```

---

With this filter, the count is lower because it only includes the records where the <var>country</var> column contains a value of <var>'USA'</var>.

There are a lot of other aggregate functions in SQL. The syntax of placing them after <var>SELECT</var> is exactly the same as the <var>COUNT</var> function.

## Continuing to learn SQL

SQL is a widely used querying language, with many more keywords and applications. You can continue to learn more about aggregate functions and other aspects of using SQL on your own.

Most importantly, approach new tasks with curiosity and a willingness to find new ways to apply SQL to your work as a security analyst. Identify the data results that you need and try to use SQL to obtain these results.

Fortunately, SQL is one of the most important tools for working with databases and analyzing data, so you'll find a lot of support in trying to learn SQL online. First, try searching for the concepts you've already learned and practiced to find resources that have accurate easy-to-follow explanations. When you identify these resources, you can use them to extend your knowledge.

Continuing your practical experience with SQL is also important. You can also search for new databases that allow you to perform SQL queries using what you've learned.

## Key takeaways

Aggregate functions like <var>COUNT</var>, <var>SUM</var>, and <var>AVG</var> allow you to work with SQL in new ways. There are many other additional aspects of SQL that could be useful to you as an analyst. By continuing to explore SQL on your own, you can expand the ways you can apply SQL in a cybersecurity context.