MySQL is equipped with several built-in functions. We have described some of the most commonly used functions:
- Aggregate functions
Aggregate functions are used to compute a set of records and return a single value. Examples of aggregate functions include SUM, COUNT, AVG, MAX, MIN, etc.
- Comparison Functions
These types of MySQL functions accept one or multiple arguments, compare them and then return a value. You should not confuse comparison functions with comparison operators. Examples of comparison functions in MySQL include COALESCE, GREATEST, INTERVAL, etc.
- Control Flow Functions and Expressions
MySQL control flow functions and expressions support if-then-else logic in queries. This can be done without using procedural code. Examples of common control flow functions include CASE, IF, NULLIF, IFNULL, etc.
MySQL joins are used to get information from several tables. They can be created when an SQL statement is used to join two or more tables. The most commonly used joins in MySQL include:
- MySQL INNER JOIN
- MySQL LEFT OUTER JOIN – It is sometimes referred to as the LEFT JOIN
- MySQL RIGHT OUTER JOIN – Can also be called the RIGHT JOIN
MySQL comparison operators are used to compare expressions in the WHERE clause. The results from these operators are always either TRUE, FALSE, or NULL. The CAST() function can be used to convert a value to a particular type when you want to compare values that are of different types. Examples of MySQL comparison operators include:
- = - Equal
- <=> - Equal used to compare NULL values
- <> - Not equal
- != - Not equal
- >= - Greater than or equal to