使用unix_timestamp方法进行比较,将字符型的时间,转成unix时间戳 select * from t1 where unix_timestamp(time1) > unix_timestamp('2011-03-03 17:39:05') and unix_timestamp(含有时间的字段) < unix_timestamp('2016-12-06');
查看数据库表基本信息. select * from information_schema.TABLES where information_schema.TABLES.TABLE_SCHEMA = '数据库名' and information_schema.TABLES.TABLE_NAME = '表名'; 查看mysql数据库大小 SELECT sum(DATA_LENGTH)+sum(INDEX_LENGTH) FROM information_schema.TABLES where TAB
问题: Mysql表中一列create_time,类型datetime(YYYY-MM-DD HH:MM:SS),想获取上个月今天到昨天的数据. select * from 表名 where date_format(create_time,'%Y-%m-%d') between date_sub(curdate(),interval 1 MONTH) and date_sub(curdate(),interval 1 day) 仔细研究了下,Mysql有很多时间类型. /*今天*/select