2016-06-27 從一次查詢中隨機返回一條數據,一般使用mysql的order by rand() 方法來實現例如: 從20萬用戶中隨機抽取1個用戶mysql> select * from user order by rand() limit 1;+-------+------------+------------- http://www.vxbq.cn/datay/25703.html
2016年06月24日 SQL優化有很多方法,今天來說一說數據庫索引。舉例說明: 假設有一個圖書Book表,里面有字段id,name, isbn等。如果圖書數量巨大的話,我們通過isbn查詢通常是比較慢的。 添加索引: create index index_isbn ON book (isbn);再次執行查詢: 查詢時 http://www.vxbq.cn/datay/25654.html