### Question

In general, what is a function?

### Answer

A very general description of a function would be: A set of tasks or procedures that can take in a value, and return another value based on that input.

Functions in programming are similar to ones that you may have seen in math. For example,

`f(x, y) = x^2 + y^2`

If we use this function with two input values, it would return the sum of the squares of both values.

Similarly, in SQL, aggregate functions can take in a column name of a table, and will return some numerical value based on the column values. For example,

`SELECT COUNT(col) FROM table;`

This will return a single number, which is the number of rows that have non-empty values in the column `col`

.

Some functions we will learn about later can even take values directly, instead of just column names, like

`ROUND(10.4, 0)`

and will return a value based on the input. The above would result in `10.0`

.