• id补齐多少位:LPAD( CONCAT( user_id, '' )
  • 用户ID后四位:substring( LPAD( CONCAT( user_id, '' ), 10, '0' ), - 4 )
  • 时间戳后8位:substring( CONCAT( UNIX_TIMESTAMP( create_time ), '' ), 3 )
  • ID后四位+时间戳后8位:CONCAT(用户ID后四位 , 时间戳后8位)
  • 字符串转json并取值:JSON_EXTRACT( cast( buy_price_size AS json ), '$."44"' )
  • 当前日期:select CURRENT_DATE()
  • 当前时间:select CURRENT_TIME()
  • 当前完整时间:select CURRENT_TIMESTAMP()
  • 明天:select CURRENT_TIMESTAMP() + INTERVAL 1 day
  • 明年:select CURRENT_TIMESTAMP() + INTERVAL 1 year
  • 当前时间戳(精确度):REPLACE ( unix_timestamp( CURRENT_TIMESTAMP ( 3 )), '.', '' )。 精确到3位,最多6位3
  • 数字转化成字符:CONCAT( 11111, '' )
  • 字符串拼接:CONCAT('a', 'b')
  • 替换字段中的部分内容:replace (field_name,'from_str','to_str')

相关文章:

  • 2021-04-25
  • 2021-09-16
  • 2021-10-26
  • 2022-03-03
  • 2021-06-30
  • 2021-08-28
  • 2022-01-22
猜你喜欢
  • 2022-01-20
  • 2021-12-10
  • 2021-06-29
  • 2021-05-22
  • 2022-02-24
  • 2022-12-23
相关资源
相似解决方案