PostgreSQL 函数

函数的定义

使用函数,可以极大的提高用户对数据库的管理效率。函数表示输入参数表示一个具有特定关系的值。

一、数学函数

绝对值函数、三角函数、对数函数、随机函数等,当有错误产生时,数学函数会返回null值。

二、函数

1、常用数值函数

PostgreSQL 函数

2、常用字符串函数

PostgreSQL 函数

PostgreSQL 函数

PostgreSQL 函数

3、日期和时间函数

PostgreSQL 函数

PostgreSQL 函数

PostgreSQL 函数

三、条件判断函数

条件判断函数亦称为控制流程函数,根据满足条件的不同,执行相应的流程。

PostgreSQL 函数

PostgreSQL 函数

PostgreSQL 函数

PostgreSQL 函数

PostgreSQL 函数

四、系统信息函数

1、获取版本号

PostgreSQL 函数

2、获取用户函数

PostgreSQL 函数

五、加密函数

1、加密函数MD5(str)

PostgreSQL 函数

2、加密函数ENCODE(str , pswd_str)

ENCODE(str , pswd_str)使用pswd_str 作为加密编码,来加密str 。常见的加密编码包括:base64 、 hex 、escape。

加密查询长度

PostgreSQL 函数

PostgreSQL 函数

业务需求需要对一些敏感数据进行加密处理

3、解密函数

DECODE(crypt_str ,pswd_str)使用pswd_str作为密码,解密加密字符串crypt_str ,crypt_str 是由ENCODE()返回的字符串

PostgreSQL 函数

六、改变数据类型

CAST(x,AS_type) 函数将一个类型的值转换为另一个类型的值;

PostgreSQL 函数    PostgreSQL 函数

七、问题

PostgreSQL 函数

相关文章: