id stringlengths 36 36 | document stringlengths 3 3k | metadata stringlengths 23 69 | embeddings listlengths 384 384 |
|---|---|---|---|
06971cf4-534f-451c-b541-0eea68cfb6ca | response title=Response
1 2
hilbertEncode {#hilbertEncode}
Introduced in: v24.6
Calculates code for Hilbert Curve for a list of unsigned integers.
The function has two modes of operation:
-
Simple
-
Expanded
Simple mode
Accepts up to 2 unsigned integers as arguments and produces a UInt64 code.
Expan... | {"source_file": "encoding-functions.md"} | [
0.026610905304551125,
-0.018869269639253616,
-0.0842558890581131,
0.01875135488808155,
-0.08789822459220886,
-0.04874962568283081,
0.02784605510532856,
0.04141439497470856,
-0.113011933863163,
-0.09666869789361954,
0.051272667944431305,
-0.0923350378870964,
0.004432070534676313,
-0.0868450... |
cc06a55e-141f-4ea6-a95c-fc22b6b88637 | 1
- no shrink
2
- 2x shrink
3
- 3x shrink
โฎ
Up to 8x shrink.
Range expansion can be beneficial when you need a similar distribution for
arguments with wildly different ranges (or cardinality). For example: 'IP Address'
(0...FFFFFFFF)
and 'Country code'
(0...FF)
. As with the encode function, this is lim... | {"source_file": "encoding-functions.md"} | [
0.03861105814576149,
0.027010874822735786,
-0.051126204431056976,
0.004011845216155052,
-0.03251200169324875,
-0.007211251650005579,
0.020615793764591217,
0.00851998571306467,
-0.10175998508930206,
-0.036254022270441055,
-0.0015557182487100363,
-0.017404453828930855,
0.03382384404540062,
-... |
1c665ba8-5ca9-4e45-9861-f6d46d041821 | Returned value
Returns a
UInt64
code.
UInt64
Examples
Simple mode
sql title=Query
SELECT mortonEncode(1, 2, 3)
response title=Response
53
Expanded mode
sql title=Query
-- Range expansion can be beneficial when you need a similar distribution for
-- arguments with wildly different ranges (or cardinality... | {"source_file": "encoding-functions.md"} | [
0.03601576015353203,
-0.02477267012000084,
-0.0810633972287178,
0.012251435779035091,
-0.10190901905298233,
-0.007147625088691711,
0.017757117748260498,
-0.0218658447265625,
-0.0261611919850111,
-0.038976039737463,
-0.0036191237159073353,
-0.031101059168577194,
0.003258912591263652,
-0.128... |
df66397c-0682-478f-acc7-98a104402804 | :::note
If
unbin
is invoked from within the
clickhouse-client
, binary strings are displayed using UTF-8.
:::
Supports binary digits
0
and
1
. The number of binary digits does not have to be multiples of eight. If the argument string contains anything other than binary digits,
the result is undefined (no except... | {"source_file": "encoding-functions.md"} | [
0.006795930210500956,
-0.026264803484082222,
-0.05764179676771164,
0.04729091376066208,
-0.1308906227350235,
-0.01490236446261406,
0.11481398344039917,
-0.035990409553050995,
-0.04389657825231552,
-0.019003557041287422,
-0.009735933504998684,
-0.02651168219745159,
0.06643662601709366,
-0.0... |
fdd7a546-1477-4bcc-a457-dab79993093e | description: 'Documentation for functions used for working with ULIDs'
sidebar_label: 'ULIDs'
slug: /sql-reference/functions/ulid-functions
title: 'Functions for working with ULIDs'
doc_type: 'reference'
Functions for working with ULIDs
:::note
The documentation below is generated from the
system.functions
syst... | {"source_file": "ulid-functions.md"} | [
-0.04581413418054581,
0.028879592195153236,
-0.04184437915682793,
0.05900616943836212,
-0.03350672125816345,
0.0065382388420403,
0.03654816746711731,
0.06867366284132004,
-0.0024567428044974804,
-0.041791610419750214,
0.006849338300526142,
-0.07468260824680328,
0.01872342824935913,
-0.1348... |
226ba8ef-6243-468f-a9c9-2f717f48011f | description: 'Documentation for Tuple Map Functions'
sidebar_label: 'Maps'
slug: /sql-reference/functions/tuple-map-functions
title: 'Map Functions'
doc_type: 'reference'
map {#map}
Creates a value of type
Map(key, value)
from key-value pairs.
Syntax
sql
map(key1, value1[, key2, value2, ...])
Arguments
... | {"source_file": "tuple-map-functions.md"} | [
0.021994272246956825,
0.004811809863895178,
0.034080300480127335,
-0.019438179209828377,
-0.06337235122919083,
0.014927630312740803,
0.08278912305831909,
-0.009624790400266647,
-0.08629045635461807,
-0.020390339195728302,
0.030949756503105164,
0.0070617529563605785,
0.05280963331460953,
-0... |
5f75383d-a30c-4d8b-9f2d-a1bb39e72373 | extractKeyValuePairs {#extractkeyvaluepairs}
Converts a string of key-value pairs to a
Map(String, String)
.
Parsing is tolerant towards noise (e.g. log files).
Key-value pairs in the input string consist of a key, followed by a key-value delimiter, and a value.
Key value pairs are separated by a pair delimiter.
Key... | {"source_file": "tuple-map-functions.md"} | [
0.024412767961621284,
0.015346899628639221,
-0.03199950233101845,
-0.034443262964487076,
-0.04919637367129326,
-0.007254085037857294,
0.09681510925292969,
0.05739499628543854,
-0.05246937647461891,
-0.0003421243163757026,
0.023610049858689308,
-0.007867769338190556,
0.0594504252076149,
-0.... |
0528956b-aa1f-406b-a3ff-efbbe22555ad | sql
SELECT extractKeyValuePairs('name"abc:5', ':', ' ,;', '\"', 'ACCEPT') AS kv;
text
โโkvโโโโโโโโโโโโโโโโโ
โ {'name"abc':'5'} โ
โโโโโโโโโโโโโโโโโโโโโ
sql
SELECT extractKeyValuePairs('name"abc":5', ':', ' ,;', '\"', 'ACCEPT') AS kv;
text
โโkvโโโโโโโโโโโโโโโโโโ
โ {'name"abc"':'5'} โ
โโโโโโโโโโโโโโโโโโโโโโ
unex... | {"source_file": "tuple-map-functions.md"} | [
-0.04468165338039398,
0.02865953929722309,
0.06742354482412338,
0.042137566953897476,
-0.06447409838438034,
0.04342962056398392,
0.07547779381275177,
-0.03523438796401024,
-0.02301936224102974,
-0.0014968867180868983,
0.0910462811589241,
-0.0748228207230568,
0.0864333063364029,
-0.06114669... |
495b4c13-b847-4690-8b44-f4fc4147a49c | Returned value
Depending on the arguments returns one
map
or
tuple
, where the first array contains the sorted keys and the second array contains values.
Example
Query with
Map
type:
sql
SELECT mapAdd(map(1,1), map(1,1));
Result:
text
โโmapAdd(map(1, 1), map(1, 1))โโ
โ {1:2} ... | {"source_file": "tuple-map-functions.md"} | [
0.057276349514722824,
0.02243640460073948,
-0.016604147851467133,
-0.00948554277420044,
-0.039073243737220764,
-0.004736210685223341,
0.11962375789880753,
-0.016493093222379684,
-0.07896950840950012,
-0.002246498130261898,
-0.016042465344071388,
0.005381484515964985,
0.05839533358812332,
-... |
dfb0e315-3b14-4b94-bc26-0c724812bf26 | Mapped arrays:
map
โ Map with integer keys.
Map
.
or
keys
โ Array of keys.
Array
(
Int
).
values
โ Array of values.
Array
(
Int
).
max
โ Maximum key value. Optional.
Int8, Int16, Int32, Int64, Int128, Int256
.
Returned value
Depending on the arguments a
Map
or a
Tuple
of two
Arrays
... | {"source_file": "tuple-map-functions.md"} | [
0.09543152898550034,
0.03370734676718712,
0.016024233773350716,
-0.0458684042096138,
-0.0616561621427536,
-0.008543086238205433,
0.07491811364889145,
-0.03716041147708893,
-0.0555494986474514,
-0.010703914798796177,
-0.055741406977176666,
0.021850675344467163,
0.04781012237071991,
0.002425... |
3f5dfb34-fbf1-4bc6-9c51-1aeef0413a3b | INSERT INTO tab VALUES ({'abc':'abc','def':'def'}), ({'hij':'hij','klm':'klm'});
SELECT mapContainsKeyLike(a, 'a%') FROM tab;
```
Result:
text
โโmapContainsKeyLike(a, 'a%')โโ
โ 1 โ
โ 0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
mapExtractKeyLike {#mapextractkeylike}
... | {"source_file": "tuple-map-functions.md"} | [
0.04851106181740761,
0.011581397615373135,
0.03045625053346157,
0.0063859266228973866,
-0.1279931515455246,
0.005395405925810337,
0.10791503638029099,
-0.02381223440170288,
-0.028640521690249443,
0.017232714220881462,
0.08092949539422989,
-0.06221179664134979,
0.09199203550815582,
-0.06203... |
f161d35c-3e7e-4470-9acc-60721d5c024b | Returned value
1
if
map
contains
value
like specified pattern,
0
if not.
Example
Query:
```sql
CREATE TABLE tab (a Map(String, String)) ENGINE = Memory;
INSERT INTO tab VALUES ({'abc':'abc','def':'def'}), ({'hij':'hij','klm':'klm'});
SELECT mapContainsValueLike(a, 'a%') FROM tab;
```
Result:
... | {"source_file": "tuple-map-functions.md"} | [
0.05953338369727135,
0.029257094487547874,
0.018787141889333725,
0.013296307064592838,
-0.09690392017364502,
-0.009721583686769009,
0.1177404448390007,
-0.003480274695903063,
-0.0370279997587204,
0.007667591329663992,
0.06654628366231918,
-0.09181926399469376,
0.05680422857403755,
-0.05327... |
b62b96f0-0967-4171-96bf-94bf652f54ed | Result:
text
โโmapโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ {'key3':0,'key1':10,'key2':10} โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
mapConcat {#mapconcat}
Concatenates multiple maps based on the equality of their keys.
If elements with the same key exist in more than one input map, all elements are added to the result map, but... | {"source_file": "tuple-map-functions.md"} | [
0.06938417255878448,
-0.02405044250190258,
0.06984133273363113,
-0.01020691730082035,
-0.06842996925115585,
-0.000664091669023037,
0.09096751362085342,
-0.03987792879343033,
-0.03396991267800331,
-0.01527873519808054,
0.07550781965255737,
0.003286849008873105,
0.07359714061021805,
-0.08632... |
5913dbb8-2cd9-4ec2-9b31-cd38681fbc93 | Syntax
sql
mapPartialSort([func,] limit, map)
Arguments
func
โ Optional function to apply to the keys and values of the map.
Lambda function
.
limit
โ Elements in range [1..limit] are sorted.
(U)Int
.
map
โ Map to sort.
Map
.
Returned value
Partially sorted map.
Map
.
Example
sql
SELECT... | {"source_file": "tuple-map-functions.md"} | [
0.06363070011138916,
-0.00777852488681674,
0.06404333561658859,
-0.06110365688800812,
-0.05329585820436478,
-0.025099126622080803,
0.05327514931559563,
-0.009026862680912018,
-0.05913933739066124,
0.07958463579416275,
0.03299028426408768,
0.031967584043741226,
-0.0026148229371756315,
-0.02... |
700bc6bb-3166-4ce1-b25b-0318ffb943d0 | description: 'Documentation for Functions for Working with Dictionaries'
sidebar_label: 'Dictionaries'
slug: /sql-reference/functions/ext-dict-functions
title: 'Functions for Working with Dictionaries'
doc_type: 'reference'
Functions for Working with Dictionaries
:::note
For dictionaries created with
DDL queries... | {"source_file": "ext-dict-functions.md"} | [
-0.016703831031918526,
-0.014580406248569489,
-0.08432993292808533,
0.006218149326741695,
-0.08719804883003235,
-0.06172670051455498,
0.09186474233865738,
0.04871220141649246,
-0.10244531184434891,
-0.0427074059844017,
0.05583468824625015,
-0.04284672066569328,
0.05096141993999481,
-0.0799... |
a8738fd8-2a8b-45b3-97bc-8fe10b039937 | Perform the query:
sql
SELECT
dictGetOrDefault('ext-dict-test', 'c1', number + 1, toUInt32(number * 10)) AS val,
toTypeName(val) AS type
FROM system.numbers
LIMIT 3;
text
โโvalโโฌโtypeโโโโ
โ 1 โ UInt32 โ
โ 2 โ UInt32 โ
โ 20 โ UInt32 โ
โโโโโโโดโโโโโโโโโ
Example for complex key dictionary
Create a text... | {"source_file": "ext-dict-functions.md"} | [
0.004385502077639103,
0.049856461584568024,
-0.10542737692594528,
0.004064422100782394,
-0.020338786765933037,
-0.06363154202699661,
0.12773706018924713,
0.07065024971961975,
-0.030039021745324135,
0.012715978547930717,
0.05100042000412941,
-0.06453239172697067,
0.09468836337327957,
-0.091... |
20c1a285-b322-42c6-af91-f72a3909ef9f | Perform the query:
sql
SELECT
(number, toDate('2019-05-20')),
dictHas('range_key_dictionary', number, toDate('2019-05-20')),
dictGetOrNull('range_key_dictionary', 'value', number, toDate('2019-05-20')),
dictGetOrNull('range_key_dictionary', 'value_nullable', number, toDate('2019-05-20')),
dictGetO... | {"source_file": "ext-dict-functions.md"} | [
0.056528493762016296,
0.01689242571592331,
-0.027085838839411736,
-0.02836545556783676,
-0.10156571120023727,
0.0405011810362339,
0.04473169893026352,
0.051002249121665955,
-0.06794287264347076,
0.03677883744239807,
0.05722688138484955,
-0.01983119361102581,
0.07168370485305786,
-0.0541735... |
3d5f8261-e638-4661-8b47-91ee0be9c7f1 | First-level children:
sql
SELECT dictGetChildren('hierarchy_flat_dictionary', number) FROM system.numbers LIMIT 4;
text
โโdictGetChildren('hierarchy_flat_dictionary', number)โโ
โ [1] โ
โ [2,3] โ
โ [4] ... | {"source_file": "ext-dict-functions.md"} | [
-0.011556187644600868,
-0.03597201406955719,
0.021325459703803062,
-0.01643506810069084,
-0.045322615653276443,
-0.1030673161149025,
0.008793942630290985,
0.021529365330934525,
-0.036128293722867966,
0.03755176439881325,
0.021163126453757286,
-0.03412669897079468,
0.017134645953774452,
-0.... |
d0ac8b4b-b6de-4113-8a65-54783b191877 | id_expr
โ Key value.
Expression
returning array of dictionary key-type value or
Tuple
-type value depending on the dictionary configuration.
limit
- Maximum length for each value array returned. When truncating, child nodes are given precedence over parent nodes, and otherwise the defined list order for the rege... | {"source_file": "ext-dict-functions.md"} | [
-0.01363968662917614,
0.02142229862511158,
-0.01845317892730236,
0.020346995443105698,
0.028897875919938087,
-0.12108352035284042,
0.11309349536895752,
-0.024098385125398636,
-0.010476063005626202,
-0.04473277926445007,
0.05295158550143242,
0.019486790522933006,
0.04057437926530838,
-0.074... |
2c0a7891-3773-42a2-9ada-5fdcb28ef035 | default_value_expr
โ Value returned if the dictionary does not contain a row with the
id_expr
key.
Expression
returning the value in the data type configured for the
attr_name
attribute.
Returned value
If ClickHouse parses the attribute successfully in the
attribute's data type
, functions return the ... | {"source_file": "ext-dict-functions.md"} | [
-0.0393059104681015,
0.011418899521231651,
-0.06389938294887543,
0.014585528522729874,
-0.02192636765539646,
-0.12724435329437256,
0.09696991741657257,
0.0007674309890717268,
-0.04068334028124809,
-0.019427936524152756,
0.08854540437459946,
-0.06201138719916344,
0.03660574555397034,
-0.018... |
291ec1ee-3b2b-4365-9d2e-d6e8a8511ecc | ```sql
-- Create dictionary
CREATE DICTIONARY all_types_dict
(
id UInt32,
String_value String,
UInt8_value UInt8,
UInt16_value UInt16,
UInt32_value UInt32,
UInt64_value UInt64,
Int8_value Int8,
Int16_value Int16,
Int32_value Int32,
Int64_value Int64,
Float32_value Float32,
... | {"source_file": "ext-dict-functions.md"} | [
0.03299611061811447,
0.024731434881687164,
-0.09528980404138565,
-0.0051855226047337055,
-0.06899674981832504,
-0.07420285791158676,
0.05986224487423897,
0.01076052337884903,
-0.048954129219055176,
0.04725949466228485,
0.059328868985176086,
-0.055305756628513336,
0.04465627670288086,
-0.06... |
af1aff8b-d248-4c49-b52a-79150d2897e0 | Insert the data into the source table:
```sql
INSERT INTO dict_mult_source VALUES
(1, 1, '1'),
(2, 2, '2'),
(3, 3, '3');
```
Create the dictionary:
```sql
CREATE DICTIONARY ext_dict_mult
(
id UInt32,
c1 UInt32,
c2 String
)
PRIMARY KEY id
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE '... | {"source_file": "ext-dict-functions.md"} | [
0.0071630836464464664,
-0.018935730680823326,
-0.04964732378721237,
0.010544355027377605,
-0.07636799663305283,
-0.13553544878959656,
0.014373349025845528,
0.04740879312157631,
-0.06570741534233093,
0.08519075065851212,
0.07545055449008942,
-0.10641477257013321,
0.12062583863735199,
-0.085... |
4866a7cf-5d1f-4914-95c0-2b48402ec48d | description: 'Documentation for Index'
sidebar: 'sqlreference'
slug: /sql-reference/functions
title: 'Landing page for Functions'
doc_type: 'landing-page'
| Page | Description ... | {"source_file": "index.md"} | [
-0.046525344252586365,
-0.024452682584524155,
-0.01758849248290062,
0.035844750702381134,
-0.006460214499384165,
0.05930903181433678,
0.04535980895161629,
0.001868721446953714,
-0.00570356659591198,
0.021717870607972145,
0.006175692658871412,
-0.014951104298233986,
0.06967499852180481,
-0.... |
1e70e7cd-5a0a-4f88-a147-894f3884b249 | description: 'Documentation for Functions for Implementing the IN Operator'
sidebar_label: 'IN Operator'
slug: /sql-reference/functions/in-functions
title: 'Functions for Implementing the IN Operator'
doc_type: 'reference'
Functions for Implementing the IN Operator
in, notIn, globalIn, globalNotIn {#in-notin-glob... | {"source_file": "in-functions.md"} | [
-0.023918068036437035,
0.010351141914725304,
-0.014584002085030079,
0.014982877299189568,
-0.06262154132127762,
-0.007385822478681803,
0.08847739547491074,
0.028793325647711754,
-0.0995786190032959,
-0.04611048102378845,
0.027737412601709366,
-0.017758961766958237,
0.04411204531788826,
-0.... |
d0448996-0b68-4555-aa34-bd8d859021b8 | description: 'Documentation for financial functions'
sidebar_label: 'Financial'
slug: /sql-reference/functions/financial-functions
title: 'Financial functions'
keywords: ['Financial', 'rate of return', 'net present value']
doc_type: 'reference'
Financial functions
:::note
The documentation below is generated from... | {"source_file": "financial-functions.md"} | [
-0.0535828098654747,
0.006876407656818628,
-0.09874052554368973,
0.0492856465280056,
-0.010285967960953712,
-0.08663105964660645,
0.06213011220097542,
0.04006943106651306,
0.06661880761384964,
0.08164780586957932,
0.024899374693632126,
-0.08189085870981216,
-0.01829157955944538,
-0.0075887... |
46748187-5a67-44d4-80d1-1967b0c25885 | Returned value
Returns the XIRR value. If the calculation cannot be performed, it returns NaN.
Float64
Examples
simple_example
sql title=Query
SELECT financialInternalRateOfReturnExtended([-10000, 5750, 4250, 3250], [toDate('2020-01-01'), toDate('2020-03-01'), toDate('2020-10-30'), toDate('2021-02-15')])
res... | {"source_file": "financial-functions.md"} | [
-0.024836348369717598,
0.01766958460211754,
-0.02725447528064251,
0.07056910544633865,
-0.003143188776448369,
-0.09519591182470322,
0.07123827189207077,
0.02650454267859459,
0.040195614099502563,
0.03205989673733711,
0.059601251035928726,
-0.1559818685054779,
-0.04544336721301079,
-0.03447... |
28763828-6cb2-4ab7-914b-d40f988cd0c9 | Syntax
sql
financialNetPresentValueExtended(rate, cashflows, dates[, daycount])
Arguments
rate
โ The discount rate to apply.
Float*
cashflows
โ Array of cash flows. Each value represents a payment (negative value) or income (positive value). Must contain at least one positive and one negative value.
Array... | {"source_file": "financial-functions.md"} | [
0.010991252958774567,
0.008975919336080551,
-0.08750376850366592,
0.05429405719041824,
-0.08064112067222595,
-0.0017982623539865017,
0.11663182824850082,
0.004297897685319185,
0.026530291885137558,
0.05507160723209381,
0.037461474537849426,
-0.15438058972358704,
-0.01441167388111353,
0.032... |
880b0dcf-ef65-42e3-9793-3ecb344104a7 | description: 'Documentation for Files'
sidebar_label: 'Files'
slug: /sql-reference/functions/files
title: 'Files'
doc_type: 'reference'
file {#file}
Reads a file as string and loads the data into the specified column. The file content is not interpreted.
Also see table function
file
.
Syntax
sql
file(path[... | {"source_file": "files.md"} | [
0.011177814565598965,
-0.026424314826726913,
-0.10719440132379532,
0.060317832976579666,
-0.04574881121516228,
-0.014348652213811874,
0.08152095228433609,
0.1300063282251358,
-0.05413384735584259,
0.022070663049817085,
0.032820045948028564,
0.06456179171800613,
0.07627835124731064,
-0.0721... |
d764339a-f345-42df-9008-9bfeca37016f | description: 'Documentation for Array Functions'
sidebar_label: 'Arrays'
slug: /sql-reference/functions/array-functions
title: 'Array Functions'
doc_type: 'reference'
Array functions
array {#array}
Introduced in: v1.1
Creates an array from the function arguments.
The arguments should be constants and ha... | {"source_file": "array-functions.md"} | [
0.0633634701371193,
-0.026371899992227554,
-0.02996951900422573,
0.025394875556230545,
-0.07585912197828293,
-0.03736783564090729,
0.11947458982467651,
0.009412389248609543,
-0.06414654105901718,
-0.04412249103188515,
-0.03103124350309372,
-0.011100773699581623,
0.040827877819538116,
-0.06... |
0a85d3a1-4d4f-44ff-a5ff-73dad0fc5b45 | higher_partitions_fp
: The number of negative labels in the higher-scored partitions.
total_positives
: The total number of positive samples in the entire dataset.
::::note
When
arr_partial_offsets
is used, the
arr_scores
and
arr_labels
should be only a partition of the entire dataset, containing an int... | {"source_file": "array-functions.md"} | [
-0.008852574042975903,
-0.00016008305829018354,
-0.07510159909725189,
-0.02268165536224842,
-0.003489759983494878,
-0.017443999648094177,
0.035615283995866776,
0.09561069309711456,
0.036205556243658066,
-0.04865902662277222,
-0.03797268494963646,
-0.02269326150417328,
0.020711101591587067,
... |
a73c1056-0df6-4267-8870-02eae4ce65e2 | response title=Response
2.5
Usage with lambda function
sql title=Query
SELECT arrayAvg(x, y -> x*y, [2, 3], [2, 3]) AS res;
response title=Response
6.5
arrayCompact {#arrayCompact}
Introduced in: v20.1
Removes consecutive duplicate elements from an array, including
null
values. The order of values in the ... | {"source_file": "array-functions.md"} | [
-0.009875958785414696,
-0.05482213944196701,
-0.02596152387559414,
-0.001835880451835692,
-0.07956364750862122,
-0.07952603697776794,
0.09708735346794128,
-0.10459310561418533,
0.019140101969242096,
-0.04506077617406845,
-0.0061775920912623405,
0.07375524938106537,
0.03626396507024765,
-0.... |
14704e34-27e3-477a-b44b-ecde960da068 | With lambda
sql title=Query
SELECT arrayCumSum(x -> x * 2, [1, 2, 3]) AS res
response title=Response
[2, 6, 12]
arrayCumSumNonNegative {#arrayCumSumNonNegative}
Introduced in: v18.12
Returns an array of the partial (running) sums of the elements in the source array, replacing any negative running sum with zer... | {"source_file": "array-functions.md"} | [
-0.02183450758457184,
0.03303409367799759,
-0.05890487879514694,
0.008886725641787052,
-0.08292661607265472,
-0.07363095879554749,
0.10736812651157379,
-0.013183344155550003,
-0.011536823585629463,
-0.02238653041422367,
-0.07644522935152054,
-0.005548423621803522,
0.052367180585861206,
-0.... |
d09d619c-6ab5-415c-9dda-04de68183466 | Returns the dot product of two arrays.
:::note
The sizes of the two vectors must be equal. Arrays and Tuples may also contain mixed element types.
:::
Syntax
sql
arrayDotProduct(v1, v2)
Arguments
v1
โ First vector.
Array((U)Int* | Float* | Decimal)
or
Tuple((U)Int* | Float* | Decimal)
v2
โ Second vec... | {"source_file": "array-functions.md"} | [
-0.006358553189784288,
-0.024888861924409866,
-0.04968647658824921,
0.005907158367335796,
0.016928842291235924,
-0.07030989974737167,
0.10429716855287552,
-0.04473786801099777,
-0.077817901968956,
-0.016997462138533592,
-0.07080328464508057,
-0.031306192278862,
0.03461720421910286,
-0.0256... |
417a5da6-c84e-4f28-a21e-32d4be14cc35 | Syntax
sql
arrayElementOrNull(arrays)
Arguments
arrays
โ Arbitrary number of array arguments.
Array
Returned value
Returns a single combined array from the provided array arguments.
Array(T)
Examples
Usage example
sql title=Query
SELECT arrayElementOrNull(arr, 2) FROM (SELECT [1, 2, 3] AS arr)
... | {"source_file": "array-functions.md"} | [
0.045295584946870804,
0.00966994185000658,
-0.025361984968185425,
0.01986808516085148,
-0.09137844294309616,
-0.0518316887319088,
0.07998333126306534,
-0.028617795556783676,
-0.005260311532765627,
-0.0517803393304348,
-0.05662551149725914,
0.02026923932135105,
0.033208027482032776,
-0.0708... |
54808be2-078b-4a9a-a09e-e90ded6a9207 | Arguments
clear_depth
โ Enumerate elements at the specified level separately. Must be less than or equal to
max_arr_depth
.
UInt*
arr
โ N-dimensional array to enumerate.
Array(T)
max_array_depth
โ The maximum effective depth. Must be less than or equal to the depth of
arr
.
UInt*
Returned value
Re... | {"source_file": "array-functions.md"} | [
-0.0138826509937644,
-0.028623206540942192,
-0.07414106279611588,
-0.01659955270588398,
-0.07793431729078293,
-0.05153834447264671,
0.07807732373476028,
-0.01473313756287098,
-0.007889309898018837,
-0.030355064198374748,
-0.07376992702484131,
0.012064680457115173,
0.0705108568072319,
-0.07... |
dfd8365b-96f4-4c65-82d1-18144146a29a | response title=Response
[1, 1, 2, 1]
Multiple arrays
sql title=Query
SELECT arrayEnumerateUniq([1, 1, 1, 2, 2, 2], [1, 1, 2, 1, 1, 2]);
response title=Response
[1,2,1,1,2,1]
ARRAY JOIN aggregation
```sql title=Query
-- Each goal ID has a calculation of the number of conversions (each element in the Goals nest... | {"source_file": "array-functions.md"} | [
0.06423182040452957,
0.058768291026353836,
-0.04909422621130943,
0.06594233959913254,
-0.061215344816446304,
0.013699410483241081,
0.07806239277124405,
-0.004121319390833378,
0.054259005934000015,
-0.012967673130333424,
-0.10609189420938492,
-0.06335944682359695,
0.0940280631184578,
0.0222... |
c1e230d8-744f-4fec-8bde-71878fdba8ac | SELECT arrayEnumerateUniqRanked(1, [[1, 2, 3], [2, 2, 1], [3]], 2);", "[[1, 1, 1], [2, 3, 2], [2]]
```
response title=Response
[1, 1, 2]
Example 3
```sql title=Query
-- In this example, arrayEnumerateUniqRanked is used to obtain an array indicating,
-- for each element of the multidimensional array, what its posi... | {"source_file": "array-functions.md"} | [
0.00846234243363142,
-0.0025183898396790028,
-0.06820458173751831,
-0.031246069818735123,
-0.04570554196834564,
-0.01411533448845148,
0.08612161129713058,
-0.0734717845916748,
0.03680623322725296,
-0.029549142345786095,
-0.03415462374687195,
0.026487763971090317,
0.10093536227941513,
-0.05... |
ef0de5b0-10ce-40c8-8fb4-9d8a66732601 | Syntax
sql
arrayExists(func(x[, y1, ..., yN]), source_arr[, cond1_arr, ... , condN_arr])
Arguments
func(x[, y1, ..., yN])
โ A lambda function which operates on elements of the source array (
x
) and condition arrays (
y
).
Lambda function
source_arr
โ The source array to process.
Array(T)
[, cond1_arr, ... | {"source_file": "array-functions.md"} | [
-0.02977333590388298,
-0.04867994040250778,
-0.05350736528635025,
-0.007078228984028101,
-0.0015962522011250257,
-0.0930369570851326,
0.1652483195066452,
-0.08726724237203598,
-0.04882107675075531,
-0.03207312151789665,
-0.06809195131063461,
0.020371589809656143,
-0.003411859506741166,
-0.... |
a40b5057-020a-43fc-acbb-96734a7e0081 | Examples
Example 1
sql title=Query
SELECT arrayFilter(x -> x LIKE '%World%', ['Hello', 'abc World']) AS res
response title=Response
['abc World']
Example 2
sql title=Query
SELECT
arrayFilter(
(i, x) -> x LIKE '%World%',
arrayEnumerate(arr),
['Hello', 'abc World'] AS arr)
AS res... | {"source_file": "array-functions.md"} | [
0.013500944711267948,
-0.00873139500617981,
-0.0048922388814389706,
0.023959621787071228,
-0.04698747768998146,
-0.05840244144201279,
0.16405659914016724,
-0.07279331982135773,
-0.09334138035774231,
-0.029408499598503113,
-0.048873741179704666,
-0.02189250849187374,
0.011512239463627338,
-... |
e96c7cff-2c6f-4f8f-a5c9-caa2f98ed229 | func(x[, y1, ..., yN])
โ A lambda function which operates on elements of the source array (
x
) and condition arrays (
y
).
Lambda function
source_arr
โ The source array to process.
Array(T)
[, cond1_arr, ... , condN_arr]
โ Optional. N condition arrays providing additional arguments to the lambda function.
Ar... | {"source_file": "array-functions.md"} | [
-0.014458107762038708,
-0.016368664801120758,
-0.04861658066511154,
0.021429257467389107,
-0.04000610113143921,
-0.030226077884435654,
0.11836166679859161,
-0.09120059013366699,
-0.055529315024614334,
-0.0011947707971557975,
-0.056522294878959656,
-0.011295734904706478,
-0.021249599754810333... |
8034ca04-b145-437b-9049-08b1235c4bad | Introduced in: v1.1
Takes multiple arrays and returns an array with elements which are present in all source arrays. The result contains only unique values.
Syntax
sql
arrayIntersect(arr, arr1, ..., arrN)
Arguments
arrN
โ N arrays from which to make the new array.
Array(T)
.
Returned value
Returns ... | {"source_file": "array-functions.md"} | [
0.027830760926008224,
-0.03730266913771629,
-0.06418076157569885,
0.03143071010708809,
-0.0017969243926927447,
-0.09542739391326904,
0.10600420087575912,
-0.0928875133395195,
-0.023700950667262077,
-0.10661857575178146,
-0.06470382958650589,
0.027634717524051666,
0.05105537176132202,
-0.04... |
92c2a2b9-c415-4dad-afc3-1af263b8184d | Using multiple arrayJoin functions
```sql title=Query
- A query can use multiple arrayJoin functions. In this case, the transformation is performed multiple times and the rows are multiplied.
SELECT
sum(1) AS impressions,
arrayJoin(cities) AS city,
arrayJoin(browsers) AS browser
FROM
(
SELECT
... | {"source_file": "array-functions.md"} | [
0.02011979930102825,
-0.02149444818496704,
-0.0005740262567996979,
0.060825053602457047,
-0.11579850316047668,
-0.03598126024007797,
0.0663154125213623,
-0.09297945350408554,
-0.05070249363780022,
-0.06963697075843811,
-0.04613984376192093,
-0.06192025914788246,
0.03694984316825867,
-0.042... |
7d5b7032-054a-40be-a2ec-80dd46e68a47 | SELECT
sum(1) AS impressions,
city,
browser
FROM
(
SELECT
['Istanbul', 'Berlin', 'Bobruisk'] AS cities,
['Firefox', 'Chrome', 'Chrome'] AS browsers
)
ARRAY JOIN
cities AS city,
browsers AS browser
GROUP BY
2,
3
```
response title=Response
โโimpressionsโโฌโcityโโโโโโฌโbrow... | {"source_file": "array-functions.md"} | [
0.07326813787221909,
-0.03785696625709534,
-0.0061243143863976,
0.06662455201148987,
-0.04704177379608154,
-0.003740506013855338,
0.065309077501297,
-0.08417575061321259,
-0.08074787259101868,
-0.041112981736660004,
0.011785470880568027,
-0.0638999491930008,
0.01970984786748886,
-0.0608716... |
bb15cf05-c2c2-4eb6-8502-c20990d13a44 | Examples
Usage example
sql title=Query
SELECT arrayLastIndex(x, y -> x=y, ['a', 'b', 'c'], ['a', 'b', 'c']);
response title=Response
3
No match
sql title=Query
SELECT arrayLastIndex(x, y -> x=y, ['a', 'b', 'c'], ['d', 'e', 'f']);
response title=Response
0
arrayLastOrNull {#arrayLastOrNull}
Introduced in... | {"source_file": "array-functions.md"} | [
-0.004723712336272001,
-0.010016611777245998,
-0.062204256653785706,
0.022538339719176292,
-0.07268825173377991,
-0.04820545017719269,
0.11870956420898438,
-0.09136810898780823,
-0.05947669595479965,
-0.01388847827911377,
-0.04918208718299866,
0.01578715816140175,
-0.014367454685270786,
-0... |
771ee1cd-b532-4e89-ba23-a5454b36e465 | arrayMap {#arrayMap}
Introduced in: v1.1
Returns an array obtained from the original arrays by applying a lambda function to each element.
Syntax
sql
arrayMap(func, arr)
Arguments
func
โ A lambda function which operates on elements of the source array (
x
) and condition arrays (
y
).
Lambda function
... | {"source_file": "array-functions.md"} | [
0.04797510430216789,
-0.018436221405863762,
-0.01245829463005066,
-0.09356493502855301,
-0.029278714209794998,
-0.06995467841625214,
0.03343290835618973,
-0.047648701816797256,
-0.07476449757814407,
0.0027792416512966156,
-0.0924469605088234,
0.06416503340005875,
0.006593889556825161,
-0.0... |
b0be36f5-ce3e-4a6b-9c71-c2e3bbaebc1c | Introduced in: v25.1
Calculates the normalized Gini coefficient.
Syntax
sql
arrayNormalizedGini(predicted, label)
Arguments
predicted
โ The predicted value.
Array(T)
label
โ The actual value.
Array(T)
Returned value
A tuple containing the Gini coefficients of the predicted values, the Gini coeff... | {"source_file": "array-functions.md"} | [
-0.0017752338899299502,
-0.030550828203558922,
-0.049000564962625504,
0.02919943444430828,
-0.055127982050180435,
-0.030443204566836357,
-0.0032880851067602634,
0.001089683035388589,
-0.03498496115207672,
0.02451833337545395,
-0.06167222186923027,
0.045940808951854706,
0.02408427558839321,
... |
1798c75c-d96f-4dbb-bd35-d5c1ca5ea36e | Syntax
sql
arrayPartialShuffle(arr [, limit[, seed]])
Arguments
arr
โ The array to shuffle.
Array(T)
seed
โ Optional. The seed to be used with random number generation. If not provided, a random one is used.
(U)Int*
limit
โ Optional. The number to limit element swaps to, in the range
[1..N]
.
(U)Int*... | {"source_file": "array-functions.md"} | [
-0.01698898896574974,
0.006241893861442804,
0.008300721645355225,
0.01613171212375164,
-0.05224732682108879,
-0.07793844491243362,
0.09121973812580109,
-0.12851962447166443,
-0.01369372196495533,
-0.041505102068185806,
-0.02702607400715351,
0.0480433888733387,
0.02478375844657421,
-0.11940... |
4bbe4412-06a0-43f9-ac53-4e82306d29be | retain_sorted
sql title=Query
SELECT arrayResize(arrayPartialSort(2, [5, 9, 1, 3]), 2)
response title=Response
[1, 3]
lambda_simple
sql title=Query
SELECT arrayPartialSort((x) -> -x, 2, [5, 9, 1, 3])
response title=Response
[9, 5, 1, 3]
lambda_complex
sql title=Query
SELECT arrayPartialSort((x, y) -> -y, ... | {"source_file": "array-functions.md"} | [
0.011703620664775372,
0.0197690911591053,
0.020430857315659523,
0.0286418404430151,
-0.05330495908856392,
-0.05977161228656769,
0.10719103366136551,
-0.07200310379266739,
0.016896061599254608,
-0.023118026554584503,
-0.010752878151834011,
0.10789141803979874,
-0.010032441467046738,
-0.0518... |
3d6fec48-8a06-4dde-b7d6-f42a211c6db0 | For more information about the types of data in ClickHouse, see
Data types
.
:::
Returned value
Returns an array identical to
arr
but with an additional value
x
at the end of the array
Array(T)
Examples
Usage example
sql title=Query
SELECT arrayPushBack(['a'], 'b') AS res;
response title=Response
['a'... | {"source_file": "array-functions.md"} | [
0.001954379491508007,
-0.01535799354314804,
-0.0931052714586258,
0.040506985038518906,
-0.12030231952667236,
-0.04927956685423851,
0.08387189358472824,
-0.04654747620224953,
0.002295848447829485,
-0.02950211986899376,
0.005595416761934757,
0.04707050323486328,
0.020856395363807678,
-0.0796... |
56da1bc3-8a79-4498-9e97-244c0d5d34e2 | higher_partitions_fp
: The number of negative labels in the higher-scored partitions.
total_positives
: The total number of positive samples in the entire dataset.
total_negatives
: The total number of negative samples in the entire dataset.
::::note
When
arr_partial_offsets
is used, the
arr_scores
and ... | {"source_file": "array-functions.md"} | [
0.03137953206896782,
-0.035551514476537704,
-0.07307747006416321,
-0.021355770528316498,
0.051721733063459396,
-0.03076021932065487,
0.050455302000045776,
0.08822459727525711,
-0.003472586628049612,
-0.06532800942659378,
-0.02938273176550865,
-0.0565326027572155,
-0.01198720745742321,
0.04... |
4bc6b9d4-c717-4ab8-8471-abfa9ef60173 | response title=Response
โโarrayReduce('max', [1, 2, 3])โโ
โ 3 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Example with aggregate function using multiple arguments
```sql title=Query
--If an aggregate function takes multiple arguments, then this function must be applied to multiple arrays of the ... | {"source_file": "array-functions.md"} | [
0.003100433386862278,
-0.01400063931941986,
0.008773463778197765,
-0.043090883642435074,
-0.0375913605093956,
-0.00973666924983263,
0.022984646260738373,
-0.01796618290245533,
-0.026987917721271515,
-0.04506026580929756,
-0.06686735898256302,
0.029485812410712242,
0.030944842845201492,
-0.... |
e6bc8f7f-6b37-4470-9ad9-9bcc3c91dfba | sql title=Query
SELECT arrayResize([1], 3, NULL);
response title=Response
[1,NULL,NULL]
arrayReverse {#arrayReverse}
Introduced in: v1.1
Reverses the order of elements of a given array.
:::note
Function
reverse(arr)
performs the same functionality but works on other data-types
in addition to Arrays.
:::
S... | {"source_file": "array-functions.md"} | [
-0.020979037508368492,
0.007516556419432163,
0.04243282228708267,
0.006765032187104225,
-0.10573931783437729,
-0.08323787897825241,
0.008171281777322292,
-0.07575346529483795,
0.010955924168229103,
0.02608485333621502,
-0.04550936073064804,
0.08062991499900818,
-0.01726934127509594,
-0.067... |
c15cfcc3-bab1-43a7-8215-c175e42ccdc6 | Returned value
Returns the array
x
sorted in descending order if no lambda function is provided, otherwise
it returns an array sorted according to the logic of the provided lambda function, and then reversed.
Array(T)
.
Examples
Example 1
sql title=Query
SELECT arrayReverseSort((x, y) -> y, [4, 3, 5], ['a', ... | {"source_file": "array-functions.md"} | [
0.0038826395757496357,
-0.04769419506192207,
0.029501518234610558,
-0.024201836436986923,
-0.07324354350566864,
-0.04953001067042351,
0.06373927742242813,
-0.03162720054388046,
-0.02686876244843006,
0.024370204657316208,
-0.022859036922454834,
0.09016746282577515,
-0.020443834364414215,
0.... |
e884ebc2-f973-402e-b897-2fab0b0f28dd | sql title=Query
SELECT arrayRotateRight([1,2,3,4,5,6], 2) as res;
response title=Response
[5,6,1,2,3,4]
Negative value of n
sql title=Query
SELECT arrayRotateRight([1,2,3,4,5,6], -2) as res;
response title=Response
[3,4,5,6,1,2]
arrayShiftLeft {#arrayShiftLeft}
Introduced in: v23.8
Shifts an array to the ... | {"source_file": "array-functions.md"} | [
0.04735978692770004,
0.021795129403471947,
-0.02721375599503517,
-0.005374323111027479,
-0.1281936913728714,
-0.059368155896663666,
0.08237003535032272,
-0.023480936884880066,
-0.01524724718183279,
-0.032365478575229645,
-0.03944902867078781,
0.04115133360028267,
0.032066710293293,
-0.0547... |
f10ceb60-d115-4ede-a193-b2c0988736cc | Examples
Usage example
sql title=Query
SELECT arrayShingles([1, 2, 3, 4], 3) as res;
response title=Response
[[1, 2, 3], [2, 3, 4]]
arrayShuffle {#arrayShuffle}
Introduced in: v23.2
Returns an array of the same size as the original array containing the elements in shuffled order.
Elements are reordered in s... | {"source_file": "array-functions.md"} | [
-0.012000086717307568,
0.03700912371277809,
-0.018214764073491096,
-0.011603527702391148,
-0.06013673171401024,
-0.06977149844169617,
0.08678276836872101,
-0.13974741101264954,
0.007582506164908409,
-0.021884463727474213,
-0.05197214335203171,
0.0766308382153511,
0.06925535202026367,
-0.12... |
7551321b-2f0c-4c3e-86cb-d7a38682ea8c | Examples
Usage example
sql title=Query
SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res;
response title=Response
[2, NULL, 4]
arraySort {#arraySort}
Introduced in: v1.1
Sorts the elements of the provided array in ascending order.
If a lambda function
f
is specified, sorting order is determined by the re... | {"source_file": "array-functions.md"} | [
0.006020182278007269,
-0.04754437133669853,
-0.0164162740111351,
-0.026995625346899033,
-0.028057221323251724,
-0.08323659002780914,
0.06376361846923828,
0.008016555570065975,
-0.016670551151037216,
0.044774968177080154,
-0.005541249644011259,
0.12173398584127426,
0.001296377507969737,
0.0... |
059548a3-e6be-4e7c-9161-3ca71a268ce2 | Arguments
func(x[, y1, ..., yN])
โ Optional. A lambda function which operates on elements of the source array (
x
) and condition arrays (
y
).
Lambda function
source_arr
โ The source array to process.
Array(T)
, cond1_arr, ... , condN_arr]
โ Optional. N condition arrays providing additional arguments to t... | {"source_file": "array-functions.md"} | [
-0.006043261848390102,
-0.009468687698245049,
-0.06253598630428314,
-0.030694512650370598,
-0.008730790577828884,
-0.07195775955915451,
0.11770151555538177,
-0.0958593487739563,
-0.00674217427149415,
-0.04695398360490799,
-0.07275641709566116,
0.023964041844010353,
0.012562369927763939,
-0... |
a27282d6-3824-4f72-9eca-49606c39e924 | arrayUniq {#arrayUniq}
Introduced in: v1.1
For a single argument passed, counts the number of different elements in the array.
For multiple arguments passed, it counts the number of different
tuples
made of elements at matching positions across multiple arrays.
For example
SELECT arrayUniq([1,2], [3,4], [5,6])... | {"source_file": "array-functions.md"} | [
0.07292160391807556,
-0.06776890158653259,
-0.072486013174057,
-0.026217211037874222,
-0.01297375001013279,
-0.0017471503233537078,
0.09896805882453918,
-0.06502124667167664,
-0.04918304458260536,
-0.044919438660144806,
-0.0429699644446373,
0.07331134378910065,
0.05598526820540428,
-0.0390... |
7f5d3e52-07af-477d-9bdc-7a04d5c4aceb | Syntax
sql
arrayZipUnaligned(arr1, arr2, ..., arrN)
Arguments
arr1, arr2, ..., arrN
โ N arrays to combine into a single array.
Array(T)
Returned value
Returns an array with elements from the source arrays grouped in tuples. Data types in the tuple are the same as types of the input arrays and in the sam... | {"source_file": "array-functions.md"} | [
0.05449783802032471,
-0.036359239369630814,
-0.06734656542539597,
0.04940720647573471,
-0.09876697510480881,
-0.02262970805168152,
0.09042544662952423,
-0.06368304044008255,
-0.04956074804067612,
-0.04112006351351738,
-0.05944124609231949,
0.053652048110961914,
0.10598427802324295,
-0.0748... |
f1cb4be3-af99-4029-b332-ed43097d0cb2 | Introduced in: v1.1
Returns an empty Float64 array
Syntax
sql
emptyArrayFloat64()
Arguments
None.
Returned value
An empty Float64 array.
Array(T)
Examples
Usage example
sql title=Query
SELECT emptyArrayFloat64
response title=Response
[]
emptyArrayInt16 {#emptyArrayInt16}
Introduced in: v1... | {"source_file": "array-functions.md"} | [
0.02806158736348152,
0.0374269112944603,
-0.07732110470533371,
0.05148366838693619,
-0.03653125464916229,
-0.07441508769989014,
0.014060511253774166,
-0.026128560304641724,
0.050842151045799255,
-0.049314405769109726,
-0.014066142030060291,
-0.007418802939355373,
-0.015351309441030025,
-0.... |
5f5e120b-facf-41bc-9459-d593c39068a8 | An empty UInt16 array.
Array(T)
Examples
Usage example
sql title=Query
SELECT emptyArrayUInt16
response title=Response
[]
emptyArrayUInt32 {#emptyArrayUInt32}
Introduced in: v1.1
Returns an empty UInt32 array
Syntax
sql
emptyArrayUInt32()
Arguments
None.
Returned value
An empty UInt32 arr... | {"source_file": "array-functions.md"} | [
0.0440620519220829,
0.043797124177217484,
-0.08413979411125183,
0.05587585270404816,
-0.08488763868808746,
-0.07257705926895142,
0.002384516876190901,
-0.037281155586242676,
0.06681840866804123,
-0.04625525325536728,
-0.028301671147346497,
-0.008923446759581566,
-0.038050130009651184,
-0.0... |
f6d1dd04-b752-4b9f-a813-681b109dc280 | Array of arrays
sql title=Query
SELECT hasAll([[1, 2], [3, 4]], [[1, 2], [3, 5]])
response title=Response
0
hasAny {#hasAny}
Introduced in: v1.1
Checks whether two arrays have intersection by some elements.
Null
is processed as a value.
The order of the values in both of the arrays does not matter.
... | {"source_file": "array-functions.md"} | [
0.06884247064590454,
-0.005457001738250256,
-0.035911574959754944,
-0.011742324568331242,
0.020666178315877914,
-0.0887940376996994,
0.09500554949045181,
-0.08568970113992691,
-0.06967340409755707,
-0.050852470099925995,
-0.02383609488606453,
0.03803233429789543,
0.006899844389408827,
-0.0... |
eb4c757f-ad76-4e90-adb8-de0f9aa83eb1 | response title=Response
0
Arrays containing strings
sql title=Query
SELECT hasSubstr(['a', 'b'], ['a'])
response title=Response
1
Arrays with valid ordering
sql title=Query
SELECT hasSubstr(['a', 'b' , 'c'], ['a', 'b'])
response title=Response
1
Arrays with invalid ordering
sql title=Query
SELECT hasSub... | {"source_file": "array-functions.md"} | [
0.03312487527728081,
-0.006583437789231539,
0.03442615643143654,
0.00807199813425541,
-0.0076174428686499596,
-0.005581013858318329,
0.005241639446467161,
-0.07760942727327347,
-0.07396863400936127,
0.005105113610625267,
-0.06157997250556946,
0.02394685707986355,
0.042854394763708115,
-0.0... |
1d180c82-c9aa-4d4c-87ea-c5d1c00f864b | It is ok to have ASCII NULL bytes in strings, and they will be counted as well.
Syntax
sql
length(x)
Aliases
:
OCTET_LENGTH
Arguments
x
โ Value for which to calculate the number of bytes (for String/FixedString) or elements (for Array).
String
or
FixedString
or
Array(T)
Returned value
Returns t... | {"source_file": "array-functions.md"} | [
0.027053313329815865,
0.025565801188349724,
-0.05945616215467453,
0.005404292605817318,
-0.1293727606534958,
-0.03430957719683647,
0.056310608983039856,
0.07177522033452988,
-0.039339806884527206,
-0.030246993526816368,
-0.02951914444565773,
-0.057228561490774155,
0.07304897904396057,
-0.0... |
7fd09537-1175-4a0e-80ec-fc358870f513 | response title=Response
1
range {#range}
Introduced in: v1.1
Returns an array of numbers from
start
to
end - 1
by
step
.
The supported types are:
-
UInt8/16/32/64
-
Int8/16/32/64]
All arguments
start
,
end
,
step
must be one of the above supported types. Elements of the returned array will be a ... | {"source_file": "array-functions.md"} | [
0.002141076372936368,
0.02253662422299385,
-0.04938112571835518,
0.014492972753942013,
-0.1009405106306076,
0.00042239250615239143,
-0.000840582069940865,
0.0632336214184761,
-0.05947251617908478,
-0.06751414388418198,
-0.041036006063222885,
0.0026962219271808863,
0.03057112917304039,
-0.0... |
0de6f360-b489-4336-b286-cee797202db2 | description: 'Documentation for string functions'
sidebar_label: 'String'
slug: /sql-reference/functions/string-functions
title: 'Functions for working with strings'
doc_type: 'reference'
import VersionBadge from '@theme/badges/VersionBadge';
Functions for working with strings
Functions for
searching
in strin... | {"source_file": "string-functions.md"} | [
-0.021323395892977715,
0.05024566128849983,
-0.06466507166624069,
0.004841926041990519,
-0.03795613721013069,
-0.01309728343039751,
0.0751458927989006,
0.06048635020852089,
-0.044831059873104095,
-0.006219749804586172,
0.012793260626494884,
-0.09554380923509598,
0.10060476511716843,
-0.070... |
2e825775-eac6-4589-9e4e-e18fd6fe6ab6 | Examples
Usage example
sql title=Query
SELECT ascii('234')
response title=Response
โโascii('234')โโ
โ 50 โ
โโโโโโโโโโโโโโโโ
base32Decode {#base32Decode}
Introduced in: v25.6
Decodes a
Base32
(RFC 4648) string.
If the string is not valid Base32-encoded, an exception is thrown.
Syntax
sql
base... | {"source_file": "string-functions.md"} | [
0.018250619992613792,
-0.01941267028450966,
-0.038960233330726624,
0.015398718416690826,
-0.07416949421167374,
-0.017762640491127968,
0.02534313127398491,
0.035004258155822754,
-0.0038309937808662653,
-0.02121927961707115,
-0.056822776794433594,
-0.07911702990531921,
0.05544121563434601,
-... |
2c2f9641-a3a4-4da1-8d8c-5b2d05250200 | response title=Response
โโbase64Decode('Y2xpY2tob3VzZQ==')โโ
โ clickhouse โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
base64Encode {#base64Encode}
Introduced in: v18.16
Encodes a string using
Base64
representation, according to RFC 4648.
Syntax
sql
base64Encode(plaintext)
Aliases
:
TO_BA... | {"source_file": "string-functions.md"} | [
0.018808439373970032,
-0.017086543142795563,
-0.02640974521636963,
0.00001389141925756121,
-0.06283295154571533,
-0.022834278643131256,
0.005627134349197149,
-0.0009270471637137234,
-0.03359992802143097,
-0.039307523518800735,
-0.004748526960611343,
-0.002183704636991024,
0.05429244041442871... |
1751f9d2-50a4-445b-9a37-b4ee83128ca7 | Extract filename from Windows path
sql title=Query
SELECT 'some\\long\\path\\to\\file' AS a, basename(a)
response title=Response
โโaโโโโโโโโโโโโโโโโโโโโโโโฌโbasename('some\\long\\path\\to\\file')โโ
โ some\long\path\to\file โ file โ
โโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโ... | {"source_file": "string-functions.md"} | [
-0.03592844307422638,
-0.02744229882955551,
-0.023572523146867752,
0.015270917676389217,
-0.08395234495401382,
-0.036357954144477844,
0.07782337814569473,
0.0780576765537262,
-0.016492202877998352,
0.0083469795063138,
0.027643274515867233,
-0.03206929191946983,
0.06789109110832214,
-0.0426... |
02a3e472-2610-49ce-8f73-523966409166 | Syntax
sql
concat([s1, s2, ...])
Arguments
s1, s2, ...
โ Any number of values of arbitrary type.
Any
Returned value
Returns the String created by concatenating the arguments. If any of arguments is
NULL
, the function returns
NULL
. If there are no arguments, it returns an empty string.
Nullable(Stri... | {"source_file": "string-functions.md"} | [
0.031001824885606766,
-0.009292318485677242,
0.009702605195343494,
0.04510406404733658,
-0.0614614300429821,
-0.051633320748806,
0.08569350093603134,
-0.016416577622294426,
-0.04979989305138588,
-0.03998972102999687,
0.01738189533352852,
-0.015170389786362648,
0.07564530521631241,
-0.07820... |
2ba32d5b-262c-4d9a-a45d-abf22024b25b | Can be used for optimization of
GROUP BY
.
Syntax
sql
concatWithSeparatorAssumeInjective(sep[, exp1, exp2, ... ])
Arguments
sep
โ The separator to use.
const String
or
const FixedString
exp1, exp2, ...
โ Expression to be concatenated. Arguments which are not of type
String
or
FixedString
are conve... | {"source_file": "string-functions.md"} | [
0.015623347833752632,
0.02015920728445053,
0.012734864838421345,
0.026256144046783447,
-0.12172260880470276,
-0.021778522059321404,
0.11708609759807587,
0.0638655498623848,
-0.07301546633243561,
-0.027810916304588318,
0.06214601546525955,
-0.022540632635354996,
0.02333461120724678,
-0.1185... |
e66b3ad0-0f89-456b-abe9-c467f40e79c2 | Returned value
Returns string
s
converted from encoding
from
to encoding
to
.
String
Examples
Usage example
sql title=Query
SELECT convertCharset('Cafรฉ', 'UTF-8', 'ISO-8859-1');
response title=Response
โโconvertCharsโฏSO-8859-1')โโ
โ Caf๏ฟฝ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
damerauLevens... | {"source_file": "string-functions.md"} | [
0.027191638946533203,
-0.05883374065160751,
-0.03565848246216774,
-0.02727370150387287,
-0.07278130948543549,
0.01924435794353485,
0.0019395067356526852,
0.01894388720393181,
0.019967759028077126,
-0.061663348227739334,
0.04395011067390442,
-0.05276261270046234,
0.1281079649925232,
-0.0638... |
cff3b2fe-ee63-4cdf-a2cc-452f91afbd5d | editDistanceUTF8 {#editDistanceUTF8}
Introduced in: v24.6
Calculates the
edit distance
between two UTF8 strings.
Syntax
sql
editDistanceUTF8(s1, s2)
Aliases
:
levenshteinDistanceUTF8
Arguments
s1
โ First input string.
String
s2
โ Second input string.
String
Returned value
Returns the edit... | {"source_file": "string-functions.md"} | [
-0.025561079382896423,
-0.030098939314484596,
-0.016994697973132133,
0.01955106109380722,
-0.11177506297826767,
0.07929665595293045,
0.006033672019839287,
0.08028725534677505,
-0.015519308857619762,
-0.002331563737243414,
0.0682559683918953,
-0.07901506125926971,
0.10789402574300766,
-0.08... |
f78b631c-b069-4fe2-b4a4-6dab2e81ff23 | Syntax
sql
endsWithCaseInsensitiveUTF8(s, suffix)
Arguments
s
โ String to check.
String
suffix
โ Case-insensitive suffix to check for.
String
Returned value
Returns
1
if
s
ends with case-insensitive
suffix
, otherwise
0
.
UInt8
Examples
Usage example
sql title=Query
SELECT endsWithCaseI... | {"source_file": "string-functions.md"} | [
0.0208746325224638,
-0.021481379866600037,
0.054459527134895325,
0.0004069512942805886,
-0.0741347149014473,
0.011056129820644855,
0.084082692861557,
0.03514517471194267,
-0.03521663323044777,
-0.038534391671419144,
0.056285008788108826,
-0.027740683406591415,
0.07233448326587677,
0.006307... |
8aee9923-5b7b-4e7c-9f76-4e0e0c4a3cc4 | response title=Response
โโfirstLine('foo\nbar\nbaz')โโ
โ foo โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
idnaDecode {#idnaDecode}
Introduced in: v24.1
Returns the Unicode (UTF-8) representation (ToUnicode algorithm) of a domain name according to the
Internationalized Domain Names in Applications
(ID... | {"source_file": "string-functions.md"} | [
-0.03980196639895439,
-0.024319717660546303,
0.008665421977639198,
-0.0390094593167305,
-0.09302382916212082,
-0.05174199491739273,
0.05230611562728882,
-0.009782508946955204,
0.040393903851509094,
-0.05211494117975235,
0.0020495119970291853,
-0.048763129860162735,
0.09835020452737808,
-0.... |
a1e6cbfd-d78c-4ab2-b420-5b2136a12fa8 | sql title=Query
SELECT initcap('John''s cat won''t eat.');
response title=Response
โโinitcap('Johโฏn\'t eat.')โโ
โ John'S Cat Won'T Eat. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
initcapUTF8 {#initcapUTF8}
Introduced in: v23.7
Like
initcap
,
initcapUTF8
converts the first letter of each word to upper case and the res... | {"source_file": "string-functions.md"} | [
0.001888464204967022,
-0.0012220435310155153,
0.06681250035762787,
0.02014130726456642,
-0.09641733020544052,
-0.029395293444395065,
0.1148785948753357,
0.02541070245206356,
0.002306201960891485,
-0.037998396903276443,
0.05703970417380333,
-0.05476713925600052,
0.11248768121004105,
-0.0313... |
bb613474-fdfc-4d71-a63a-54c50602fe08 | Syntax
sql
jaroWinklerSimilarity(s1, s2)
Arguments
s1
โ First input string.
String
s2
โ Second input string.
String
Returned value
Returns the Jaro-Winkler similarity between the two strings.
Float64
Examples
Usage example
sql title=Query
SELECT jaroWinklerSimilarity('clickhouse', 'click')
... | {"source_file": "string-functions.md"} | [
-0.008229054510593414,
-0.03775883466005325,
-0.010603617876768112,
-0.011683802120387554,
-0.08214011043310165,
0.003849201602861285,
0.04223709553480148,
0.09323243796825409,
-0.061374954879283905,
-0.046392254531383514,
0.03313157334923744,
0.005411628633737564,
0.07230672240257263,
-0.... |
c1cd468b-a492-4b7b-9b83-6d160fb93f13 | length
โ The length of the resulting string. If the value is smaller than the input string length, then the input string is shortened to
length
characters.
(U)Int*
pad_string
โ Optional. The string to pad the input string with. If not specified, then the input string is padded with spaces.
String
Returned v... | {"source_file": "string-functions.md"} | [
-0.00185038719791919,
0.014345511794090271,
-0.0068520125932991505,
0.02092294581234455,
-0.06600962579250336,
0.01725872978568077,
0.05339215323328972,
0.10664516687393188,
-0.010252510197460651,
-0.039410319179296494,
0.005322770215570927,
0.019309047609567642,
0.07625477761030197,
-0.07... |
eaa26a7d-7bbe-4357-8e4c-7e8e09b6d34b | Syntax
sql
lowerUTF8(input)
Arguments
input
โ Input string to convert to lowercase.
String
Returned value
Returns a lowercase string.
String
Examples
first
sql title=Query
SELECT lowerUTF8('Mรผnchen') as Lowerutf8;
response title=Response
mรผnchen
normalizeUTF8NFC {#normalizeUTF8NFC}
Introduc... | {"source_file": "string-functions.md"} | [
0.033244650810956955,
0.014830795116722584,
0.0025100363418459892,
-0.0026905157137662172,
-0.11059210449457169,
0.012230025604367256,
0.03429766744375229,
0.07801026850938797,
-0.018191244453191757,
-0.07329737395048141,
-0.009449206292629242,
-0.015884477645158768,
0.0751129686832428,
-0... |
d1768b59-7e33-4d52-9557-4f77a4fab506 | sql
normalizeUTF8NFKD(str)
Arguments
str
โ UTF-8 encoded input string.
String
Returned value
Returns the NFKD normalized form of the UTF-8 string.
String
Examples
Usage example
sql title=Query
SELECT
'HโOยฒ' AS original, -- H + subscript 2 + O + superscript 2
norma... | {"source_file": "string-functions.md"} | [
0.022363334894180298,
-0.016905857250094414,
-0.027934275567531586,
0.06069301441311836,
-0.10014801472425461,
0.02703944407403469,
0.03435719758272171,
0.045377958565950394,
-0.03586861491203308,
-0.038753166794776917,
0.0006574949948117137,
-0.029622254893183708,
0.00009686506382422522,
... |
14e6dbd1-263a-487d-b665-08bc8970f39f | Syntax
sql
right(s, offset)
Arguments
s
โ The string to calculate a substring from.
String
or
FixedString
offset
โ The number of bytes of the offset.
(U)Int*
Returned value
Returns:
- For positive
offset
, a substring of
s
with
offset
many bytes, starting from the right of the string.
- For n... | {"source_file": "string-functions.md"} | [
-0.045582208782434464,
-0.004076236858963966,
-0.058316919952631,
-0.02971617504954338,
-0.09574458003044128,
0.006971792317926884,
0.05482105538249016,
0.11415233463048935,
-0.03550887852907181,
-0.020967865362763405,
0.07462378591299057,
0.022263145074248314,
0.048576753586530685,
-0.101... |
2474e665-f412-4561-a50f-526086f9ce86 | rightUTF8 {#rightUTF8}
Introduced in: v22.1
Returns a substring of UTF-8 encoded string
s
with a specified
offset
starting from the right.
Syntax
sql
rightUTF8(s, offset)
Arguments
s
โ The UTF-8 encoded string to calculate a substring from.
String
or
FixedString
offset
โ The number of bytes of ... | {"source_file": "string-functions.md"} | [
-0.02017473615705967,
-0.04462805390357971,
-0.008415690623223782,
-0.03302088379859924,
-0.13013899326324463,
0.06521482020616531,
0.06418301165103912,
0.058282364159822464,
-0.006274896673858166,
-0.0487949401140213,
0.0401010736823082,
0.0047875321470201015,
0.034299369901418686,
-0.074... |
ff04484a-5864-408e-86a9-f0f3ee522284 | sparseGramsHashes {#sparseGramsHashes}
Introduced in: v25.5
Finds hashes of all substrings of a given string that have a length of at least
n
,
where the hashes of the (n-1)-grams at the borders of the substring
are strictly greater than those of any (n-1)-gram inside the substring.
Uses
CRC32
as a hash function... | {"source_file": "string-functions.md"} | [
0.008959172293543816,
-0.009500265121459961,
-0.03898081183433533,
-0.05044747516512871,
-0.013376758433878422,
-0.01640958897769451,
0.047419484704732895,
0.04717390984296799,
-0.04266190528869629,
-0.015847662463784218,
-0.009722384624183178,
-0.029889941215515137,
0.06101605296134949,
-... |
7791b21d-4cd8-488a-b986-effe39b1b540 | max_ngram_length
โ Optional. The maximum length of extracted ngram. The default value is 100. Should be not less than
min_ngram_length
.
UInt*
Returned value
Returns an array of selected UTF-8 substrings.
Array(String)
Examples
Usage example
sql title=Query
SELECT sparseGramsUTF8('ะฐะปะธัะฐ', 3)
response ... | {"source_file": "string-functions.md"} | [
-0.005093120038509369,
-0.05647401139140129,
-0.046204593032598495,
-0.0035110251046717167,
-0.06287316232919693,
-0.01907355710864067,
0.08186672627925873,
0.07128483802080154,
-0.049610454589128494,
-0.046112556010484695,
0.004055535886436701,
-0.000014013199688633904,
0.00917259231209755,... |
ee870de6-f222-4ece-b2ff-92bcf3152b43 | Returned value
Returns
1
if
s
starts with
prefix
, otherwise
0
.
UInt8
Examples
Usage example
sql title=Query
SELECT startsWithUTF8('ะฟัะธััะฐะฒะบะฐ', 'ะฟัะธ')
response title=Response
โโstartsWithUTโฏะบะฐ', 'ะฟัะธ')โโ
โ 1 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
stringBytesEntropy {#stringBytesEntrop... | {"source_file": "string-functions.md"} | [
0.010364189743995667,
-0.032718442380428314,
-0.057075925171375275,
0.03560928255319595,
-0.07815594226121902,
-0.017275309190154076,
0.11495735496282578,
-0.00237276847474277,
0.03458278253674507,
0.021017951890826225,
-0.029776547104120255,
-0.04041670262813568,
0.07558809220790863,
-0.0... |
71e5562a-f80f-4134-a71f-997e782e8be7 | An optional argument
length
specifies the maximum number of bytes the returned substring may have.
Syntax
sql
substring(s, offset[, length])
Aliases
:
byteSlice
,
mid
,
substr
Arguments
s
โ The string to calculate a substring from.
String
or
FixedString
or
Enum
offset
โ The starting position o... | {"source_file": "string-functions.md"} | [
-0.018833568319678307,
-0.0211500097066164,
-0.0014127959730103612,
-0.002582718851044774,
-0.02819780632853508,
-0.0212387815117836,
0.04696585610508919,
0.1111159697175026,
0.0038060387596488,
-0.05098314955830574,
-0.0731901079416275,
0.04184595122933388,
0.03578171879053116,
-0.0886002... |
fa7835d7-4d56-4100-ac05-7e028815a9c5 | Examples
UTF8 example
sql title=Query
SELECT substringIndexUTF8('www.straรen-in-europa.de', '.', 2)
response title=Response
www.straรen-in-europa
substringUTF8 {#substringUTF8}
Introduced in: v1.1
Returns the substring of a string
s
which starts at the specified byte index
offset
for Unicode code points... | {"source_file": "string-functions.md"} | [
-0.010852803476154804,
0.004392086993902922,
0.013460232876241207,
-0.008072982542216778,
-0.09524527937173843,
0.0026112240739166737,
0.05386306717991829,
0.11880868673324585,
0.016263708472251892,
-0.063606396317482,
-0.012938403524458408,
-0.03336622193455696,
0.07355616241693497,
-0.03... |
9be5d823-66bf-4955-b9af-6d0b80fe653c | response title=Response
โโtrimBoth('$$โฏse$$', '$')โโ
โ ClickHouse โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
trimLeft {#trimLeft}
Introduced in: v20.1
Removes the specified characters from the start of a string.
By default, removes common whitespace (ASCII) characters.
Syntax
sql
trimLeft(input[, trim_chara... | {"source_file": "string-functions.md"} | [
0.01753087155520916,
0.017420759424567223,
0.07999852299690247,
0.06866545230150223,
-0.11310754716396332,
-0.0268965195864439,
0.09038292616605759,
-0.0007493303855881095,
0.0034706387668848038,
-0.01637384667992592,
0.09066159278154373,
0.00961625762283802,
0.06987284123897552,
-0.062426... |
8fada8a6-e57a-4289-a694-542a5395aabe | tryBase64Decode {#tryBase64Decode}
Introduced in: v18.16
Like
base64Decode
, but returns an empty string in case of error.
Syntax
sql
tryBase64Decode(encoded)
Arguments
encoded
โ String column or constant to decode. If the string is not valid Base64-encoded, returns an empty string in case of error.
St... | {"source_file": "string-functions.md"} | [
0.033943451941013336,
-0.020260678604245186,
-0.0264522023499012,
0.04013602435588837,
-0.06495731323957443,
-0.01954037696123123,
0.009118846617639065,
-0.0016415041172876954,
-0.01733480580151081,
-0.01986510679125786,
0.03130904585123062,
-0.06636248528957367,
0.0719982460141182,
-0.029... |
31fd8d67-fd79-40d8-9017-4b667e927ff0 | Converts the ASCII Latin symbols in a string to uppercase.
Syntax
sql
upper(s)
Aliases
:
ucase
Arguments
s
โ The string to convert to uppercase.
String
Returned value
Returns an uppercase string from
s
.
String
Examples
Usage example
sql title=Query
SELECT upper('clickhouse')
response tit... | {"source_file": "string-functions.md"} | [
-0.013451623730361462,
-0.047795847058296204,
0.04791427031159401,
0.007947618141770363,
-0.10609415173530579,
-0.049661632627248764,
0.07901446521282196,
0.06871623545885086,
-0.01488299760967493,
-0.0566800981760025,
0.024190425872802734,
-0.020534804090857506,
0.06365228444337845,
-0.03... |
74a476b4-acc4-42d0-b386-91edd9cdc4af | description: 'Landing page for Regular Functions'
slug: /sql-reference/functions/regular-functions
title: 'Regular functions'
doc_type: 'landing-page' | {"source_file": "regular-functions-index.md"} | [
0.026610499247908592,
-0.025355007499456406,
-0.009625433944165707,
-0.011622351594269276,
-0.04573903977870941,
-0.05120929330587387,
-0.0048690419644117355,
0.03387890011072159,
-0.08537156134843826,
-0.012330184690654278,
-0.017059145495295525,
0.015098980627954006,
0.019351527094841003,
... |
bdefa103-afe9-4027-8e71-bfff38825c20 | | Page | Description |
|--------------------------------------------------|-------------------------------------------------------------------------------------... | {"source_file": "regular-functions-index.md"} | [
-0.03776535764336586,
0.007811244111508131,
-0.008746998384594917,
-0.005856119096279144,
-0.034302882850170135,
0.03278353437781334,
0.07533968240022659,
-0.08125396817922592,
-0.03930547833442688,
0.03320636972784996,
-0.015387850813567638,
0.019681433215737343,
0.018273325636982918,
-0.... |
ccf54be3-21fd-4ea8-84d2-f8e4bda7a6b9 | |
Tuples
| Functions for working with tuples. |
|
String replacement
| Functions for string replacement. |
|
User Defined Functi... | {"source_file": "regular-functions-index.md"} | [
-0.058638084679841995,
-0.03746117651462555,
-0.0253500547260046,
-0.015084800310432911,
-0.02491561509668827,
-0.06851882487535477,
-0.006327095441520214,
0.028922714293003082,
-0.06868783384561539,
-0.023197200149297714,
-0.0166825782507658,
0.0037151528522372246,
-0.00761303910985589,
-... |
b1579c2c-fa44-4951-9d38-f4ea0d5ca9df | |
Distance
| Functions for calculating vector norms, distances, normalization, and common operations in linear algebra and machine learning. |
|
Bitmap
| Functions for bitmaps. |
|
Math
| Mathematical functio... | {"source_file": "regular-functions-index.md"} | [
-0.004071983974426985,
0.0060438127256929874,
-0.0754312202334404,
-0.10223130881786346,
0.00622026901692152,
-0.042548879981040955,
-0.009112750180065632,
-0.008415281772613525,
-0.03949238732457161,
-0.034308064728975296,
0.04292711615562439,
0.009138805791735649,
0.010031802579760551,
0... |
6d348e6b-0b84-4a53-bfa0-2cc05c178f3f | description: 'Documentation for Functions for Working with Dates and Times'
sidebar_label: 'Dates and time'
slug: /sql-reference/functions/date-time-functions
title: 'Functions for Working with Dates and Times'
doc_type: 'reference'
Functions for working with dates and times
Most functions in this section accept ... | {"source_file": "date-time-functions.md"} | [
0.01434731762856245,
0.017459716647863388,
-0.0017877474892884493,
0.03671831265091896,
0.027674881741404533,
-0.04664033651351929,
0.011477828025817871,
0.021552519872784615,
-0.029239267110824585,
0.018044255673885345,
-0.028710009530186653,
-0.12004879117012024,
-0.07730040699243546,
0.... |
aa8f39ce-6568-4b99-bd1a-b2a2bfdbe98b | response title=Response
โโYYYYMMDDToDate32(20000507)โโ
โ 2000-05-07 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
YYYYMMDDhhmmssToDateTime {#YYYYMMDDhhmmssToDateTime}
Introduced in: v23.9
Converts a number containing the year, month, day, hour, minute, and second to a
DateTime
.
This function is the opposite ... | {"source_file": "date-time-functions.md"} | [
0.013875346630811691,
0.0056164986453950405,
-0.022518964484333992,
0.014176402240991592,
-0.025185249745845795,
-0.026501810178160667,
0.013548780232667923,
0.04055462405085564,
-0.013725432567298412,
-0.05087846890091896,
-0.010698771104216576,
-0.11245135962963104,
-0.003369123674929142,
... |
9e7d0a06-8186-4661-a0c3-ba03ff0e5aff | addDays {#addDays}
Introduced in: v1.1
Adds a specified number of days to a date, a date with time or a string-encoded date or date with time.
Syntax
sql
addDays(datetime, num)
Arguments
datetime
โ Date or date with time to add specified number of days to.
Date
or
Date32
or
DateTime
or
DateTime64
... | {"source_file": "date-time-functions.md"} | [
0.0043013193644583225,
-0.018698273226618767,
0.010414916090667248,
0.11723469942808151,
-0.10739191621541977,
-0.01820058561861515,
0.058726564049720764,
-0.010133612900972366,
-0.09300799667835236,
0.024582838639616966,
0.056973401457071304,
-0.1012863889336586,
-0.026964228600263596,
-0... |
9be08926-75fb-4d3d-8214-d6fe454f226b | addInterval {#addInterval}
Introduced in: v22.11
Adds an interval to another interval or tuple of intervals.
:::note
Intervals of the same type will be combined into a single interval. For instance if
toIntervalDay(1)
and
toIntervalDay(2)
are passed then the result will be
(3)
rather than
(1,1)
.
:::
Syn... | {"source_file": "date-time-functions.md"} | [
-0.03186032548546791,
-0.02514783665537834,
0.028303921222686768,
0.06773904711008072,
-0.08059253543615341,
0.0007644444121979177,
0.0370694138109684,
-0.01998252049088478,
-0.005489191506057978,
-0.04385355859994888,
0.06222127750515938,
-0.12136147171258926,
0.0299794040620327,
-0.03114... |
c4f6f8f8-ae1f-4f7e-83e2-9e06ceafedbc | Introduced in: v22.6
Adds a specified number of milliseconds to a date with time or a string-encoded date with time.
Syntax
sql
addMilliseconds(datetime, num)
Arguments
datetime
โ Date with time to add specified number of milliseconds to.
DateTime
or
DateTime64
or
String
num
โ Number of millisecond... | {"source_file": "date-time-functions.md"} | [
0.062300875782966614,
-0.03496021777391434,
-0.03725738823413849,
0.07524675875902176,
-0.09759880602359772,
0.03512944281101227,
-0.001181969651952386,
0.0637054443359375,
0.011733205057680607,
-0.007669472135603428,
0.018555620685219765,
-0.1068357452750206,
-0.01949441060423851,
-0.0180... |
f97fdb6b-9b9e-4bed-8c37-c8382d626c80 | Introduced in: v1.1
Adds a specified number of months to a date, a date with time or a string-encoded date or date with time.
Syntax
sql
addMonths(datetime, num)
Arguments
datetime
โ Date or date with time to add specified number of months to.
Date
or
Date32
or
DateTime
or
DateTime64
or
String
n... | {"source_file": "date-time-functions.md"} | [
0.032196417450904846,
-0.0740765631198883,
-0.09280598908662796,
0.08589369803667068,
-0.08261621743440628,
0.02307179942727089,
-0.0362633541226387,
0.004795580171048641,
-0.04177108034491539,
0.056370459496974945,
0.06959212571382523,
-0.0828423947095871,
-0.024509551003575325,
-0.086196... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.