Mysql 语句积累

//向表中插入记录
insert into ff (username,record,log) values ('stevenjohn','mysqllog','logrecord');
//从表中去十条记录
select * from ff  limit 10
//取出来据现在最近的一条记录
select * from (select * from ff  order by createtime desc) as t  limit 1
//查询记录数
select count(*) from ff
//根据record,createtime 查询出来记录数
select record,createtime,count(record) from ff where username='stevenjohn' group by record,createtime order by createtime desc

select record,createtime,count(record) from ff where username='stevenjohn' group by record,createtime order by count(record) desc
//获取Mysql系统时间
select now() as systime
select sysdate() as systime
select current_date as systime
//
select * from abing where to_days(sysdate())=to_days(createtime);
select * from abing where to_days(sysdate())=to_days(createtime);
 select * from abing where str_to_date(now(),'%Y-%m-%d')=str_to_date(createtime,'%Y-%m-%d');


你可能感兴趣的:(mysql)