mysql | 数据库索引、日期等应用

1.添加索引、修改索引

-- 添加索引

create index ship_date_index on flo_sample (ship_date);

格式:

 

 -- 修改索引

alter table flo_sample add index ship_date_index (ship_date);

 

2.日期格式应用

查询日期间隔天数

select DATEDIFF(SYSDATE(),ship_date) from flo_sample

查询前一天

select date_sub(curdate(),interval 1 day)

 

posted @ 2021-08-30 11:15  fla_fly  阅读(159)  评论(0)    收藏  举报