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),'-','')
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博客 ” ,链接:http://blog.itpub.net/29667072/viewspace-2123902/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29667072/viewspace-2123902/