alter table rpt_leakpop_hourly change thehour thehour datetime;
ALTER TABLE table_name ADD column_name TYPE;
ALTER TABLE 表名 DROP 新列名 (mysql)
ALTER TABLE 表名 DROP COLUMN 列名;(oracle)
alter table 表名 change column employeeID empID int;(后面要加上数据类型)(mysql)
alter table tablename rename column oldcolumnname to newcolumnname;(oracle)
create table 新表名 select * from 就表名;
rename table oldtablename to newtablename;
7)某条语句的执行时间
select SQL_NO_CACHE * from tablename;
8)创建用户
create user 'test'@'localhost' IDENTIFIED BY 'testpasswd';(注意localhost是指定为本机访问)
grant all privileges on solrclient.* to suse@localhost identified by 'suse‘;
alter table table_name add index index_name(column_list)
alter table table_name add unique(column_list)
alter table table_name add primary key(column_list)
create index index_name on table_name (column_list)
create unique index index_name on table_name(column_list)
DROP INDEX index_name ON talbe_name
ALTER TABLE table_name DROP INDEX index_name
ALTER TABLE table_name DROP PRIMARY KEY
12)导出数据库中的数据表
A、mysqldump -uroot -pstat --opt stat rpt_test_daily > rpt_test_daily.sql (PAT:可以多个表同时导出)
B、scp rpt_stat_daily.sql username@hostname:目录
C、进入mysql命令下:source /home/wangsumei/rpt_phonedown_daily.sql
13)select outfile
读出user表的内容,字段间以‘,’分隔存储到user.txt文件中
select id,name into OUTFILE 'user.txt' fields terminated by ',' from user;