zoukankan      html  css  js  c++  java
  • mysql avg()函数,获取字段的平均值

    mysql> select * from table1;
    +----------+------------+-----+---------------------+
    | name_new | transactor | pid | order_date          |
    +----------+------------+-----+---------------------+
    | 1hahha   | 1xiaohong  |   1 | 2019-08-04 20:45:47 |
    | 2hahha   | 2xiaohong  |   2 | 2019-08-04 20:45:57 |
    | 3hahha   | 3xiaohong  |   3 | 2019-08-04 20:46:02 |
    | 4hahha   | 4xiaohong  |   4 | 2019-08-04 20:46:05 |
    | 3hahha   | bob        |   5 | 2019-08-04 20:46:08 |
    | 3hahha   | lee        |   6 | 2019-08-04 20:46:12 |
    +----------+------------+-----+---------------------+
    6 rows in set (0.00 sec)
    
    
    mysql> select avg(pid) from table1;
    +----------+
    | avg(pid) |
    +----------+
    |   3.5000 |
    +----------+
    1 row in set (0.00 sec)
    
    
    mysql> select (21/6);
    +--------+
    | (21/6) |
    +--------+
    | 3.5000 |
    +--------+
    1 row in set (0.00 sec)

  • 相关阅读:
    jQuery中的表单验证
    使用jQuery操作DOM对象
    jQuery中的事件和动画
    jQuery的选择器
    divise
    Word History airplay
    a前缀
    con词根
    vert词根
    quest词根
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11299861.html
Copyright © 2011-2022 走看看