ITPub博客

首页 > 数据库 > MySQL > mysql 基础

mysql 基础

原创 MySQL 作者:影中漫步 时间:2016-08-24 10:49:53 0 删除 编辑
1.修改列类型
alter table table1 modify column server varchar(20);
2.增加索引(单列):
alter table table1 add index tbl_idx (ds);
3.增加索引(多列):
alter table table1 add index tbl_idx (ds,card_id);
4.查看当前表索引:
show index from tblname;
5.删除索引:
ALTER TABLE table_name DROP INDEX index_name;


二、数据查询  
1.将(2016-08-01或2016-08-01 11:12:11) 转化为20160801
regexp_replace(substr(create_time,1,10),'-','')

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29667072/viewspace-2123902/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-05-19

  • 博文量
    15
  • 访问量
    26328