MYSQL Basics to Know…..PART-3

 

MYSQL Basics to Know…..PART-3

AGGREGATE FUNCTIONS — collects a set of values to return a single value.

I have used my favorite comic data in creating a database and a table.

  1. The Vision, Volume 1: Little Worse Than A Man
  2. Batman: The killing Joke
  3. Venom, Volume 1: Homecoming
  4. Venom, Volume 2: The Abyss
  5. The Flash: A Celebration of 75 Years

COUNT(): counts the number of rows in a database.

COUNT() syntax
COUNT() syntax

MIN(): It shows the lowest number of values in a table.

MIN() syntax

MAX(): It shows the highest number of values in a table.

MAX() syntax

For MIN Title and pages. In this below syntax, it shows only Title and pages which is in ascending order and has a LIMIT -1 (which gives only 1 row of data).

For MIN Title and pages

The below syntax is based on descending order which can be also used for MAX() syntax.

ORDER BY()

SUM(): It calculates the sum of a selected set of columns.

SUM() syntax

AVG(): It calculates the average of a selected set of columns.

AVG() syntax

Comments

Popular posts from this blog

MYSQL - “LIKE operator”