ifnull是postgresql自带的function吗
1个回答
2016-09-02
展开全部
POSTGRESQL没有IFNULL函数,有
COALESCE
COALESCE(value [, ...])The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. It is often used to substitute a default value for null values when data is retrieved for display, for example:
SELECT COALESCE(description, short_description, '(none)') ...
Like a CASE expression, COALESCE only evaluates the arguments that are needed to determine the result; that is, arguments to the right of the first non-null argument are not evaluated. This SQL-standard function provides capabilities similar to NVL and IFNULL, which are used in some other database systems.
没有DateDiff对应的函数,直接相减
date '2001-10-01' - date '2001-09-28' integer '3' (days)
COALESCE
COALESCE(value [, ...])The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. It is often used to substitute a default value for null values when data is retrieved for display, for example:
SELECT COALESCE(description, short_description, '(none)') ...
Like a CASE expression, COALESCE only evaluates the arguments that are needed to determine the result; that is, arguments to the right of the first non-null argument are not evaluated. This SQL-standard function provides capabilities similar to NVL and IFNULL, which are used in some other database systems.
没有DateDiff对应的函数,直接相减
date '2001-10-01' - date '2001-09-28' integer '3' (days)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询