In MySQL, The "MIN()" and "MAX()" functions are aggregate functions used to find the minimum and maximum values, respectively, within a set of values.
These functions can be used in SELECT statements to find the minimum or maximum value of a specific column.
The MIN() function returns the smallest value in a set.
SELECT MIN(price) AS min_price_product FROM products;
Note: This query retrieves the minimum price from the "products" table and aliases the result as "min_price_product".
The MAX() function returns the largest value in a set.
SELECT MAX(price) AS max_price_product FROM products;
Note: This query retrieves the maximum price from the "products" table and aliases the result as "max_price_product".
We can combine the "MIN()" and "MAX()" functions in a single query to find both the minimum and maximum values within a set.
SELECT MIN(price) AS min_price_product, MAX(price) AS max_price_product FROM products;
Note: This query retrieves the minimum and maximum price product from the entire products table.