zoukankan      html  css  js  c++  java
  • MySQL的截取字符串和链接字符串函数

    MySQL在查询或者更新数据的时候,有字符串函数可用。

    截取字符串函数:substring、instr

    用法如下:

    update `table` set field5 = SUBSTRING(field5  , 1 , INSTR( field5 ,'-')-1) where id = 1; //这里,要从field5里面最开始一直截取到‘-’的地方(不包括‘-’)。注意,substring是从1开始,而不是一般的程序函数从0开始。

     

    字符串链接函数:contact

    用法如下:

    update `table` set field5 = concact(field5  , 'somestr') where id = 1; //这里,要吧field5和‘somestr’链接起来,再更新到field5

     

  • 相关阅读:
    稀疏核机
    核方法
    变分法
    拉格朗日乘子
    序列数据
    连续隐含变量
    线性回归模型
    采样方法
    线性分类模型
    一些音乐下的评论
  • 原文地址:https://www.cnblogs.com/whatmiss/p/2838530.html
Copyright © 2011-2022 走看看