MySQL Functions
This section gives you the most commonly used MySQL functions including aggregate functions, string functions, date time functions, control flow functions, etc.
This section gives you the most commonly used MySQL functions including aggregate functions, string functions, date time functions, control flow functions, etc.
MySQL aggregate functions
- MySQL aggregate function - provides a brief overview of the most commonly used MySQL aggregate functions
- AVG - calculates the average value of a set of values or an expression.
- COUNT - count the number rows in a table.
- SUM - calculates the sum of a set of values or an expression.
- MIN - finds the minimum value in a set of values
- MAX - finds the maximum value in a set of values
- GROUP_CONCAT – concatenates strings from a group into a string with various options such as
DISTINCT
, ORDER BY
and SEPARATOR
.
- MySQL standard deviation functions – shows you how to compute population standard deviation and sample standard deviation by using functions:
STD
, STDDEV
,STDDEV_POP
and STDDEV_SAMP
. In addition, the population variance and sample variance functions such as VAR_POP
, VARIANCE
and VAR_SAMP
are also covered.
- MySQL aggregate function - provides a brief overview of the most commonly used MySQL aggregate functions
- AVG - calculates the average value of a set of values or an expression.
- COUNT - count the number rows in a table.
- SUM - calculates the sum of a set of values or an expression.
- MIN - finds the minimum value in a set of values
- MAX - finds the maximum value in a set of values
- GROUP_CONCAT – concatenates strings from a group into a string with various options such as
DISTINCT
,ORDER BY
andSEPARATOR
. - MySQL standard deviation functions – shows you how to compute population standard deviation and sample standard deviation by using functions:
STD
,STDDEV
,STDDEV_POP
andSTDDEV_SAMP
. In addition, the population variance and sample variance functions such asVAR_POP
,VARIANCE
andVAR_SAMP
are also covered.
MySQL string functions
- CONCAT - combines two or more strings into one string.
- LENGTH and CHAR_LENGTH - get the length of strings in bytes and in characters.
- REPLACE - searches and replaces a substring in a string.
- SUBSTRING - extracts a substring starting from a position with a specific length.
- CONCAT - combines two or more strings into one string.
- LENGTH and CHAR_LENGTH - get the length of strings in bytes and in characters.
- REPLACE - searches and replaces a substring in a string.
- SUBSTRING - extracts a substring starting from a position with a specific length.
MySQL control flow functions
MySQL date and time functions
- DATEDIFF - calculates the number of days between two
DATE
or DATETIME
values.
- DATE_FORMAT – formats a date value based on a specified date format.
- STR_TO_DATE - converts a string into a date and time value based on a specified format.
- NOW - returns the current date and time at which the statement executed.
- DATEDIFF - calculates the number of days between two
DATE
orDATETIME
values. - DATE_FORMAT – formats a date value based on a specified date format.
- STR_TO_DATE - converts a string into a date and time value based on a specified format.
- NOW - returns the current date and time at which the statement executed.
Other MySQL functions
- LAST_INSERT_ID - obtains the last generated sequence number of the last inserted record.
- CAST – converts a value of any type into a value with a specified type.
- LAST_INSERT_ID - obtains the last generated sequence number of the last inserted record.
- CAST – converts a value of any type into a value with a specified type.