ClickHouse/docs/en/sql-reference/functions/comparison-functions.md

36 lines
820 B
Markdown
Raw Normal View History

2020-04-03 13:23:32 +00:00
---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/functions/comparison-functions
sidebar_position: 36
sidebar_label: Comparison
2020-04-03 13:23:32 +00:00
---
2022-06-02 10:55:18 +00:00
# Comparison Functions
Comparison functions always return 0 or 1 (Uint8).
The following types can be compared:
- numbers
- strings and fixed strings
- dates
- dates with times
within each group, but not between different groups.
2020-03-20 10:10:48 +00:00
For example, you cant compare a date with a string. You have to use a function to convert the string to a date, or vice versa.
Strings are compared by bytes. A shorter string is smaller than all strings that start with it and that contain at least one more character.
2022-06-02 10:55:18 +00:00
## equals, a = b and a == b operator
2022-06-02 10:55:18 +00:00
## notEquals, a != b and a \<\> b operator
2022-06-02 10:55:18 +00:00
## less, \< operator
2022-06-02 10:55:18 +00:00
## greater, \> operator
2022-06-02 10:55:18 +00:00
## lessOrEquals, \<= operator
2022-06-02 10:55:18 +00:00
## greaterOrEquals, \>= operator