concat
Concatenate strings — build labels, composite keys, and display values.
Signature
concat(s1: String, s2: String, ...): StringReturns
String
What it does
Concatenates two or more strings into a single String. Arguments that are not strings are cast automatically. The || operator is an alias for concat in ClickHouse.
concat() is straightforward but important for building composite keys and display labels in ClickHouse queries. Use it to build event_category + '_' + event_action labels, tenant-prefixed identifiers, or formatted display strings. For array-to-string joins, use arrayStringConcat(arr, separator) instead.
Notes
- Non-String arguments are cast to String automatically.
- For array-to-string, use arrayStringConcat(arr, ',').
- concatWithSeparator(sep, s1, s2, ...) is cleaner when using a consistent separator.
Example SQL
concat in ClickHouse SQL
TypeScript with hypequery
Use concat in a typed TypeScript query
hypequery gives you a type-safe query builder for ClickHouse. The generated schema maps your ClickHouse columns to TypeScript types, and raw SQL expressions let you incorporate functions like concat when you need them inside a builder query.
Common questions
What developers search for with concat
ClickHouse string concatenation query
concat(a, b) or the || operator joins strings. concatWithSeparator(sep, s1, s2) is cleaner for building delimited keys.
FAQ
Frequently asked questions about concat
Does concat() handle NULL values?
In ClickHouse, NULL in concat produces an empty string for that argument, not a NULL result. This differs from standard SQL.
Related guides
Next step
Use concat in a type-safe TypeScript query
hypequery generates TypeScript types from your ClickHouse schema. Use concat alongside the builder, and reach for raw SQL expressions when the function is not exposed as a dedicated helper.