zoukankan      html  css  js  c++  java
  • MySQL之字符串函数

    1. left函数, 对查询字段的字符串内容进行截取,用法select left(content,50) as summary from article; 在这里的意思是只查询content列内容的前50个字符,在这里汉字也只当作一个字符。

    2. right函数,与left函数刚好相反,它对内容从后面进行截取。

    3. upper函数,对查询的内容中的小写字母进行大写处理。select upper(title) as title from article;

    4. lower函数,和upper刚好相反,它是进行小写处理。

    5. substr函数,对字符串从指定位置,进行指定长度的裁剪,它比left和right更灵活。 select substr(content, 10, 50) from article, 从第10个字符(第一个字符为1不为0)开始截取50个字符;select substr(content,10)    from article,从第10个字符开始截取到末尾;select substr(content, –20) from article,从末尾起截取20个字符。

    待续。。。

  • 相关阅读:
    mysql的四种隔离
    mysql-事物
    Mysql数据备份
    线程池
    springboot整合log4j2
    springboot项目部署
    数组去重
    倒叙输出算法
    使用LLDB和debugserver对ios程序进行调试
    Linux使用pyinstaller 编译py成可执行程序
  • 原文地址:https://www.cnblogs.com/hgfrzh/p/3392548.html
Copyright © 2011-2022 走看看