Coginiti menu Coginiti menu

SQL Average

SQL AVG is an aggregate function that calculates the average value of a specific column in a table.

The syntax for using the AVG function in SQL is:

SELECT AVG(column_name)
FROM table_name;

For example, suppose you have a table named bookshop with a price column and you need to answer what is the average price of the books. The following query would do it for you:

FROM bookshop;

But if you need to know the average price only for the Fiction books, you could use a WHERE clause to calculate. Here’s how the statement would look like:

  genre = 'Fiction';

In these examples, the AVG function calculates the average value of a specific column.

SQL AVG in Coginiti

Coginiti allows you to apply the aggregation functionality to any column by dragging and dropping the values you want to find the average.

Here’s an example of how you can sum rows in Coginiti Grid:

  1. Open the Grid View
  2. Click “Columns’”
  3. Drag and drop the values you want to aggregate.A screenshot showing the aggregation functions in the Coginiti Grid.

Note that when you drop a column to “Values,” it will come with the last function used. Click on it to change and scroll to find the aggregate function you want.

A GIF showing how to select an aggregation function in the Coginiti Grid.