ClickHouse常用函数
- URL Decode: decodeURLComponent
时间函数
- 转年月: toYYYYMM
- 时间戳转时间: FROM_UNIXTIME
常用SQL
case
when(strarea = '764') then '泰国'
when(strarea = '608') then '菲律宾'
when(strarea = '704' ) then '越南'
when(strarea = '458' ) then '马来西亚'
when(strarea = '360' ) then '印尼'
else '其他' end AS country
转换函数
字符串/数字转换函数
toInt8(expr) — 结果为Int8数据类型。
toInt16(expr) — 结果为Int16数据类型。
toInt32(expr) — 结果为Int32数据类型。
toInt64(expr) — 结果为Int64数据类型。
- toInt(8|16|32|64)OrZero
- toInt(8|16|32|64)OrNull
- toUInt(8|16|32|64)
- 5.toDecimal(32|64|128)
- toDecimal(32|64|128)OrNull
- toDecimal(32|64|128)OrZero
- toString
- CAST(x, T)
- toInterval(Year|Quarter|Month|Week|Day|Hour|Minute|Second)
把一个数值类型的值转换为Interval类型的数据。
- parseDateTimeBestEffort
把String类型的时间日期转换为DateTime数据类型。
时间转换函数
fromUnixTimestamp64Nano │ 0 │ 0 │ │
│ fromUnixTimestamp64Micro │ 0 │ 0 │ │
│ fromUnixTimestamp64Milli │ 0 │ 0 │ │
│ toUnixTimestamp64Nano │ 0 │ 0 │ │
│ toUnixTimestamp64Micro │ 0 │ 0 │ │
│ toUnixTimestamp64Milli │ 0 │ 0 │ │
│ toUnixTimestamp
网友评论