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.
- The Vision, Volume 1: Little Worse Than A Man
- Batman: The killing Joke
- Venom, Volume 1: Homecoming
- Venom, Volume 2: The Abyss
- The Flash: A Celebration of 75 Years
COUNT(): counts the number of rows in a database.
MIN(): It shows the lowest number of values in a table.
MAX(): It shows the highest number of values in a table.
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).
The below syntax is based on descending order which can be also used for MAX() syntax.
SUM(): It calculates the sum of a selected set of columns.
AVG(): It calculates the average of a selected set of columns.
Comments
Post a Comment