INFOMAN Lesson 8
INFOMAN Lesson 8
PK
Output:
MySQL Function
SUBSTRING()
Output:
CURTIME()
This gives us the current time.
MySQL Aggregate Function
An aggregate function is a function that performs
calculation on a set of values and returns the result
of the calculation as a single value.
Table Name: employees
MySQL Aggregate Function
COUNT()
• Returns the number of the rows in the table.
• If we pass in * to the function, it returns the total number of rows
in the table.
• If we pass in a column name instead, it returns the number of non
NULL values in that column (NULL values are ignored).
• If we want to remove duplicates, we add the DISTINCT keyword
before the column name.
MySQL Aggregate Function
COUNT()
MySQL Aggregate Function
COUNT()
MySQL Aggregate Function
COUNT()
MySQL Aggregate Function
AVERAGE()
• Function returns the average of a set of values.
MySQL Aggregate Function
ROUND()
• Returns the number to round off and the number of
decimal places we want it rounded off to.
MySQL Aggregate Function
MAX()
• Returns the maximum of a set of values.
MySQL Aggregate Function
MIN()
• Returns the minimum of a set of values.
MySQL Aggregate Function
SUM()
• Returns the sum of a set of values.
MySQL Aggregate Function
GROUP BY()
• MySQL allows us to group data when performing
calculations.
MySQL Aggregate Function
GROUP BY()
• MySQL allows us to group data when performing
calculations.
MySQL Aggregate Function
IF()
• MySQL IF() takes three expressions and if the first
expression is true, not zero and not NULL, it returns the
second expression. Otherwise, it returns the third
expression.
MySQL Aggregate Function
IF()
• Function returns the maximum of a set of values.
MySQL Aggregate Function
IF()
MySQL Subqueries
• A subquery is a SQL query nested inside a larger
query.
MySQL Subqueries
MySQL Subqueries
MySQL Subqueries
MySQL Subqueries
End of
Lesson 8
44