MOD
Return the remainder for a division operation, where the first parameter is divided by the second.
MOD(number, number)
Both number
expressions must evaluate to integer or DECIMAL values.
For example:
premdb=# select mod(22, 21.234) from sys.const;
mod
-------
0.766
(1 row)
premdb=# select name, mod(avg_att,capacity) from team where capacity>0 order by 2 desc;
name | mod
-------------------------+--------
Manchester United | 75.286
Arsenal | 59.944
Manchester City | 54.041
Newcastle United | 49.754
Liverpool | 43.910
Sunderland | 43.071
...
premdb=# select seasonid, season_name from season where mod(seasonid,2)=1 order by 1,2;
seasonid | season_name
----------+-------------
1 | 1992-1993
3 | 1994-1995
5 | 1996-1997
7 | 1998-1999
9 | 2000-2001
11 | 2002-2003
13 | 2004-2005
15 | 2006-2007
17 | 2008-2009
19 | 2010-2011
21 | 2012-2013
23 | 2014-2015
25 | 2016-2017
(13 rows)
Parent topic:Mathematical Functions