sql语句小结

select * from iftest;
select ifnull(salary,0) from iftest;
select if(salary>3000,'high','low') from iftest;
select case when salary<=4000 then 'low' else 'high' end from iftest;
select case salary when 2000 then '贫农' when 3000 then '温饱' else '小康'  end  from  iftest;
select password('bilibo');
select md5('bilibo');
show variables like 'time_zone';
select mod(3,2);
select 1<=>1,2<=>0,0<=>0,null<=>null;
select 'abcdef' regexp 'ab','abcdefg' regexp 'k';
select curdate();
select now() current, date_add(now(),interval -24 year) birthday;
select datediff('2010-09-01',now());
 

你可能感兴趣的:(sql)