Comparison

Notice:
Some of the examples below are referenced from ClickHouse Documentation but have been adapted and modified to work in ByteHouse.

greatest

Returns the largest value of a and b.

Syntax

greatest(a, b)

Arguments

  • a,b – two values to compare

Returned value

  • the larger value of a,b.

Example

SELECT greatest(1, 2)
┌─greatest(1, 2)─┐
│ 2              │
└────────────────┘
SELECT greatest(toDate('2019-01-01'), toDate('2019-01-02'))
┌─greatest(toDate('2019-01-01'), toDate('2019-01-02'))─┐
│ 2019-01-02                                           │
└──────────────────────────────────────────────────────┘

notEquals

notEquals, a != b and a <> b operator

Syntax

notEquals(a, b)
a!=b
a<>b

Arguments

  • a,b – two values to compare

Returned value

  • UInt8

Example

SELECT notEquals(1, 1), 1!=1, 1<>1
┌─notEquals(1, 1)─┬─notEquals(1, 1)─┬─notEquals(1, 1)─┐
│ 0               │ 0               │ 0               │
└─────────────────┴─────────────────┴─────────────────┘
SELECT notEquals(1, 2), 1!=2, 1<>2
┌─notEquals(1, 2)─┬─notEquals(1, 2)─┬─notEquals(1, 2)─┐
│ 1               │ 1               │ 1               │
└─────────────────┴─────────────────┴─────────────────┘

notEquals

notEquals, a != b and a <> b operator

Syntax

notEquals(a, b)
a!=b
a<>b

Arguments

  • a,b – two values to compare

Returned value

  • UInt8

Example

SELECT notEquals(1, 1), 1!=1, 1<>1
┌─notEquals(1, 1)─┬─notEquals(1, 1)─┬─notEquals(1, 1)─┐
│ 0               │ 0               │ 0               │
└─────────────────┴─────────────────┴─────────────────┘
SELECT notEquals(1, 2), 1!=2, 1<>2
┌─notEquals(1, 2)─┬─notEquals(1, 2)─┬─notEquals(1, 2)─┐
│ 1               │ 1               │ 1               │
└─────────────────┴─────────────────┴─────────────────┘

Did this page help you?