Appearance
MIN
Return the minimum value for an expression (numeric, character, or datetime).
MIN(expression)
Note: The input expression
for a MIN function cannot be a Boolean data type.
The following example returns the starting matchday
for each season.
premdb=# SELECT seasonid, MIN(matchday) FROM match
WHERE matchday IS NOT NULL GROUP BY seasonid ORDER BY seasonid;
seasonid | min
----------+---------------------
2 | 1993-08-14 00:00:00
3 | 1994-08-20 00:00:00
4 | 1995-08-19 00:00:00
5 | 1996-08-17 00:00:00
6 | 1997-08-09 00:00:00
7 | 1998-08-15 00:00:00
8 | 1999-08-07 00:00:00
9 | 2000-08-19 00:00:00
10 | 2001-08-18 00:00:00
11 | 2002-08-17 00:00:00
12 | 2003-08-16 00:00:00
13 | 2004-08-14 00:00:00
14 | 2005-08-13 00:00:00
15 | 2006-08-19 00:00:00
16 | 2007-08-11 00:00:00
17 | 2008-08-16 00:00:00
18 | 2009-08-15 00:00:00
19 | 2010-08-14 00:00:00
20 | 2011-08-13 00:00:00
21 | 2012-08-18 00:00:00
22 | 2013-08-17 00:00:00
(21 rows)
The following example returns the "minimum" nickname
value from the team
table:
premdb=# SELECT MIN(nickname) FROM team;
min
---------
Addicks
(1 row)
MIN and MAX with NaN Values
Yellowbrick supports NaN
(not a number) as a floating-point value. When MIN and MAX functions are applied to data that contains NaN
values, NaN
is returned as the maximum value. NaN
sorts as greater than all other floating-point values, including +inf
(infinity).
Parent topic:Aggregate Functions