Skip to main content

DIV0

Introduced or updated: v1.2.345

Returns the quotient by dividing the first number by the second one. Returns 0 if the second number is 0.

See also:

Syntax

DIV0(<number1>, <number2>)

Examples

SELECT
DIV0(20, 6),
DIV0(20, 0),
DIV0(20, NULL);

┌───────────────────────────────────────────────────┐
│ div0(20, 6) │ div0(20, 0) │ div0(20, null)
├────────────────────┼─────────────┼────────────────┤
3.33333333333333350NULL
└───────────────────────────────────────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today