abs(x) —>绝对值 abs(-17.4) —>17.4 cbrt(double) —>立方根 cbrt(27.0) —>3 ceil(double/numeric) —>不小于参数的最小的整数 ceil(-42.8) —>-42 floor(double/numeric) —>不大于参数的最大整数 floor(-42.8) —>-43 mod(y, x) —>取余数 mod(9,4) 1 random() —>0.0到1.0之间的随机数值 random() sqrt(double/numeric) —>平方根 sqrt(2.0) —>1.4142135623731 trunc(double/numeric) —>截断(向零靠近) trunc(42.8) —>42 trunc(v numeric, s int) —>截断为s小数位置的数字 trunc(42.438,2) —>42.43
string 丨丨 string —>字串连接 ‘Post’ 丨丨 ‘greSQL’ —>PostgreSQL lower(string) —>把字串转化为小写 lower(‘TOM’) —>tom upper(string) —>把字串转化为大写。upper(‘tom’) —>TOM substring(string from int for int]) —>抽取子字串 substring(‘Thomas’ from 2 for 3) —>hom substr(string, from int for int) —>抽取子字串。 substr(‘alphabet’, 3, 2) —> ph length(string text) —>string中字符的数目 length(‘jose’) —>4
to_char(int, text) —>整型转换为字符串 to_char(125, ‘999’) to_char(double precision, text) —>双精度转换为字符串 to_char(125.8::real, ‘999D9’) to_char(numeric, text) —>数字转换为字符串 to_char(-125.8, ‘999D99S’) to_date(text, text) —>字符串转换为日期 to_date(‘05 Dec 2000’, ‘DD Mon YYYY’) to_number(text, text) —>转换字符串为数字 to_number(‘12,454.8-’, ‘99G999D9S’) to_timestamp(text, text) —>转换为指定的时间格式 time zone convert string to time stamp to_timestamp(‘05 Dec 2000’, ‘DD Mon YYYY’)