Video Tutorial SQL 11. Count, Group By with MySql Workbench

SQL COUNT FUNCTION

The SQL COUNT function returns the number of rows in a query.

SQL COUNT(*) Syntax

SELECT COUNT(*)
FROM table_name

SQL COUNT(*) EXAMPLE

Below we have our "authors" table.

With the Count() function we are going to count the number of authors we have;

SQL GROUP BY FUNCTION

The SQL GROUP BY clause is used to arrange identical data into groups.

SQL GROUP BY Syntax

SELECT column1, column2  
FROM table_name  
WHERE [ conditions ]  
GROUP BY column1, column2

SQL GROUP BY EXAMPLE

For this example we are going to take a look at the table "books";

With this table we are going to write a query so that we group the authors of the books;

<< Previous Next >>