zoukankan      html  css  js  c++  java
  • MYSQL 复制表

    create table wa_amount as select

        -> sum(case when amount<1000 then 1 else 0 end) as'0-999' ,

        -> sum(case when amount<2000 && amount >999 then 1 else 0 end) as'1000-1999' ,

        -> sum(case when amount<3000 && amount >1999 then 1 else 0 end) as'2000-2999' ,

        -> sum(case when amount<4000 && amount >2999 then 1 else 0 end) as'3000-3999' ,

        -> sum(case when amount < 5000 && amount >3999 then 1 else 0 end) as'4000-4999' ,

        -> sum(case when amount < 6000 && amount >4999 then 1 else 0 end) as'5000-5999' ,

        -> sum(case when amount < 7000 && amount >5999 then 1 else 0 end) as'6000-6999' ,

        -> sum(case when amount < 8000 && amount >6999 then 1 else 0 end) as'7000-7999' ,

        -> sum(case when amount < 9000 && amount >7999 then 1 else 0 end) as'8000-8999' ,

        -> sum(case when amount < 10000 && amount >8999 then 1 else 0 end) as'9000-9999'

        -> from sortamount;

    用as 只复制结构、数据

    用like,会复制所有,包括索引、外键;

  • 相关阅读:
    mysql事务
    python zip dict函数
    有关mysql索引
    hash(散列函数)
    Docker使用
    Mac终端命令自动补全
    python序列化与反序列化(json与pickle)
    python txt、excel读写
    python 正则表达式
    python进行数据预处理-pandas
  • 原文地址:https://www.cnblogs.com/07byte/p/5823650.html
Copyright © 2011-2022 走看看