9951 explained code solutions for 126 technologies


clickhouseHow to use user-defined function


SELECT test(date, age) FROM tblctrl + c
test(

name of the created user-defined function

date, age

arguments of the user-defined function (in our case - date and age columns)

tbl

table to select data from


Usage example

SELECT test(date, age) FROM tbl LIMIT 5
output
┌─concat(toString(age), ', ', toString(toYear(date)))─┐
│ 0, 1970                                             │
│ 125, 1970                                           │
│ 0, 1970                                             │
│ 125, 1970                                           │
│ 0, 1970                                             │
└─────────────────────────────────────────────────────┘