跳转到内容

返回第一个数除以第二个数的商。如果第二个数为 0,则返回 0。

另请参阅:

func.div0(<numerator>, <denominator>)
func.div0(20, 6), func.div0(20, 0), func.div0(20, null)
┌─────────────────────────────────────────────────────────────┐
│ func.div0(20, 6) │ func.div0(20, 0) │ func.div0(20, null) │
├────────────────────┼──────────────────┼─────────────────────┤
│ 3.3333333333333335 │ 0 │ NULL │
└─────────────────────────────────────────────────────────────┘
DIV0(<number1>, <number2>)
SELECT
DIV0(20, 6),
DIV0(20, 0),
DIV0(20, NULL);
┌───────────────────────────────────────────────────┐
│ div0(20, 6) │ div0(20, 0) │ div0(20, null) │
├────────────────────┼─────────────┼────────────────┤
│ 3.3333333333333335 │ 0 │ NULL │
└───────────────────────────────────────────────────┘