美文网首页
ClickHouse 常用函数

ClickHouse 常用函数

作者: 蓝天白云_Sam | 来源:发表于2022-04-22 14:54 被阅读0次

    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
    

    转换函数

    字符串/数字转换函数

      1. toInt(8|16|32|64)
    toInt8(expr) — 结果为Int8数据类型。
    toInt16(expr) — 结果为Int16数据类型。
    toInt32(expr) — 结果为Int32数据类型。
    toInt64(expr) — 结果为Int64数据类型。
    
      1. toInt(8|16|32|64)OrZero
      1. toInt(8|16|32|64)OrNull
      1. toUInt(8|16|32|64)
    • 5.toDecimal(32|64|128)
      1. toDecimal(32|64|128)OrNull
      1. toDecimal(32|64|128)OrZero
      1. toString
      1. CAST(x, T)
      1. toInterval(Year|Quarter|Month|Week|Day|Hour|Minute|Second)
        把一个数值类型的值转换为Interval类型的数据。
      1. parseDateTimeBestEffort
        把String类型的时间日期转换为DateTime数据类型。

    时间转换函数

     fromUnixTimestamp64Nano  │            0 │                0 │          │
    │ fromUnixTimestamp64Micro │            0 │                0 │          │
    │ fromUnixTimestamp64Milli │            0 │                0 │          │
    │ toUnixTimestamp64Nano    │            0 │                0 │          │
    │ toUnixTimestamp64Micro   │            0 │                0 │          │
    │ toUnixTimestamp64Milli   │            0 │                0 │          │
    │ toUnixTimestamp 
    

    相关文章

      网友评论

          本文标题:ClickHouse 常用函数

          本文链接:https://www.haomeiwen.com/subject/ezrllltx.html