1. 程式人生 > >常用查詢集合oracle、mysql、sqlserver

常用查詢集合oracle、mysql、sqlserver

1、統計資料庫的表的總數

       mysql:SELECT count(*) TABLES, table_schema FROM information_schema.TABLES  where table_schema = 'test' GROUP BY table_schema

2、時間戳的轉化

  mysql:select * from test o WHERE  FROM_UNIXTIME(ftime,'%Y-%m-%d %h:%i')<'2013-06-14 03:48'  order by o.ftime desc limit 0,1

3、將常規日期型別轉換成時間戳int

   mysql UNIX_TIMESTAMP('2011-05-31 23:50:50');