`
haiziwoainixx
  • 浏览: 409532 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

mysql常用命令

阅读更多

重命名 rename table oldname to newname
修改表长度: alter table poi3 modify poi_name varchar(400);
建联合索引(也可以去重复):
唯一:alter ignore table poi3 add unique index poi_name,address,phone_number);
其他:alter table xc add index ind_name(name),add index ind_status(status);
删除索引:drop index addr_index on poi3;
查看建表语句: show create table name;
给表增加字段:alter table poi3 add rpoi_id int(11) ;
删除字段:alter table r_poi drop column fir_copy;
修改表:
alter table r_poi modify smell double(5,1),modify server double(5,1),modify aura double(5,1);
 导出查询结果:
mysql -uroot -plbs26ps lbs_comment -e"select sc from r_poi_comment limit 20">1.txt


操作数值:
四舍五入:round()
舍去小数: floor()
如果小数部分有值就进一 ceil() 或者 ceiling()
排重:
insert into temp(poi_id,img) select poi_id,url from r_poi_img;
insert into temp1(id) select id from temp group by poi_id having count(distinct poi_id) =1;

 

loadfile:

mysql -h127.0.0.1 -uroot -pyicha.123 smartad -e "LOAD DATA LOCAL INFILE 'click_temp.txt' into table click_temp (ad_id)";

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics