![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mysql
千年-today
Stay hungry Stay foolish
展开
-
MySql行转列的方法,case when
例如下表将其转换为在oracle中,我们能使用decode函数,在mysql中decode函数和oracle该函数功能是不同的,我们需要使用case when then end(注意要有end),sql语句如下SELECT t.ddate,MAX(CASE t.res WHEN '胜' THEN t.count END) AS "胜",MAX(CASE t.res WHEN '负' ...原创 2019-09-06 08:49:21 · 330 阅读 · 0 评论 -
MySql索引种类以及使用注意事项
索引类型:1.普通索引最常使用的索引,create index index_name on table_name(col_name(length))2.唯一索引和普通索引类似。索引列值唯一,和主键不同,允许有空值create unique index index_name on table_name(col_name(length))3.全文索引仅适用于MyISAM的存储引擎存储的...原创 2019-09-11 10:04:00 · 154 阅读 · 0 评论