Database Reference
In-Depth Information
FROM table_name GROUP BY column_name1,
column_name2;
MAX and MIN : MAX is another aggregate function, which returns the maxim-
um value from a set of numbers, while MIN returns the minimum value from a
set of numbers. Both MAX and MIN support single numeric arguments or nu-
meric results of a function or any expression applied to a column value. Both
MAX and MIN ignore NULL values, and for empty tables both return NULL res-
ults. The output data type of MAX and MIN is the same as its input argument
data type.
When MAX or MIN is used with the GROUP BY clause, both return one value
for each combination of grouping values. The following is the syntax and a
few examples of using MAX functions:
SELECT MAX(column_name) FROM table_name;
Examples:
SELECT MAX(days) FROM full_year_data
WHERE month='October' and year = '2013';
SELECT MAX(DISTINCT A) FROM table_name;
SELECT column_name1, column_name2,
MAX(column_name3) FROM table_name GROUP
BY column_name1, column_name2;
And here is the syntax and a few examples of using MIN functions:
SELECT MIN(column_name) FROM table_name;
Examples:
SELECT MIN(LENGTH(s)) FROM table_name;
SELECT column_name1, MIN(column_name2)
FROM table_name ORDER BY column_name1 ;
Search WWH ::




Custom Search