一、时间戳
mysql> select unix_timestamp(now());+-----------------------+| unix_timestamp(now()) |+-----------------------+| 1541604376 |+-----------------------+1 row in set (0.00 sec)mysql> select current_timestamp();+---------------------+| current_timestamp() |+---------------------+| 2019-01-04 20:37:19 |+---------------------+1 row in set (0.00 sec)
二、ddl
1、增加表字段
添加在最后一列
alter table TABLE_NAME add column NEW_COLUMN_NAME varchar(20) not null;
添加在某一列之后
alter table TABLE_NAME add column NEW_COLUMN_NAME varchar(20) not null after COLUMN_NAME;
添加在第一列
alter table TABLE_NAME add column NEW_COLUMN_NAME varchar(20) not null first;
2、修改表名
alter table ts01 rename to ts01_new;
3、修改字段
修改字段类型
alter table table1 modify column column1 decimal(10,1) DEFAULT NULL COMMENT ‘注释’;
修改字段名称、类型
ALTER TABLE 表名 CHANGE 旧字段名 新字段名 新数据类型;
alter table table1 change column1 column2 varchar(100) DEFAULT 1.2 COMMENT ‘注释’
