- 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')
相关文章: