zoukankan      html  css  js  c++  java
  • sql 基础--mysql 5 (4)

    9.数据处理函数

      文本处理:Upper 大写

    mysql> select uid,name,msg, Upper(name) as UpperName from pw_luck;
    +-----+-----------+------+-----------+
    | uid | name      | msg  | UpperName |
    +-----+-----------+------+-----------+
    |   0 | Wilson    |  100 | WILSON    |
    |   1 | zhangsan  |  100 | ZHANGSAN  |
    |   2 | lisi      | 1001 | LISI      |
    |   3 | wang5     | 1001 | WANG5     |
    |   7 | zhangsan7 | 1000 | ZHANGSAN7 |
    |   8 | zhangsan8 | 1000 | ZHANGSAN8 |
    |   9 | zhangsan9 | 1000 | ZHANGSAN9 |
    |  10 | wang5     | 1000 | WANG5     |
    |  11 | wang5%    | 2000 | WANG5%    |
    |  12 | WANG5     | 1000 | WANG5     |
    +-----+-----------+------+-----------+
    10 rows in set (0.02 sec)

      文本处理:Soundex匹配所有发音类似的项

    mysql> select uid,name,msg, Upper(name) from pw_luck where Soundex(name)=Soundex('wangwu');
    +-----+--------+------+-------------+
    | uid | name   | msg  | Upper(name) |
    +-----+--------+------+-------------+
    |   3 | wang5  | 1001 | WANG5       |
    |  10 | wang5  | 1000 | WANG5       |
    |  11 | wang5% | 2000 | WANG5%      |
    |  12 | WANG5  | 1000 | WANG5       |
    +-----+--------+------+-------------+
    4 rows in set (0.03 sec)

      日期和时间处理函数

        Data() 2012-12-12

        Year()  2012

        Mounth() 2

      数值处理: Abs绝对值 Cos余弦 Exp指数 Mod余数 Sqrt平方根

    mysql> select name,msg,Sqrt(msg) from pw_luck;
    +-----------+------+--------------------+
    | name      | msg  | Sqrt(msg)          |
    +-----------+------+--------------------+
    | Wilson    |  100 |                 10 |
    | zhangsan  |  100 |                 10 |
    | lisi      | 1001 |  31.63858403911275 |
    | wang5     | 1001 |  31.63858403911275 |
    | zhangsan7 | 1000 | 31.622776601683793 |
    | zhangsan8 | 1000 | 31.622776601683793 |
    | zhangsan9 | 1000 | 31.622776601683793 |
    | wang5     | 1000 | 31.622776601683793 |
    | wang5%    | 2000 | 44.721359549995796 |
    | WANG5     | 1000 | 31.622776601683793 |
    +-----------+------+--------------------+
    10 rows in set (0.02 sec)
    

      

  • 相关阅读:
    gmap 整理
    记录一次mybatis genertor使用以及mapper扫描遇见的问题
    mysql 记录
    NOIP2018Day1!!!题目出炉!!!
    图论——倍增求LCA
    干货系列——模板 之 图论1
    数学专题1
    动态规划——背包问题1:01背包
    图论——最短路——Dijkstra算法
    数据结构——并查集
  • 原文地址:https://www.cnblogs.com/wjw334/p/4288080.html
Copyright © 2011-2022 走看看