標籤:mysqlorder by排序:在結果集出來之後才有意義 必須在where ,group by ,having 之後desc(降序)/asc(升序)用欄位排序 用shop_price 降序排列select goods_name,cat_id,shop_price from goods where cat_id=4 order by shop_price desc;多個排序選擇,先根據cat_id,然後shop_priceselect
標籤:show processlist mysql sending data MariaDB [(none)]> show processlist;+--------+--------+------------------+---------+-------------+---------+---------------+----------------------+--------|
標籤: 想必大家在用MySQL時都會遇到連線逾時的問題,如所示: 就是這個異常(com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:Communications link failure Last packet sent to the server was X ms
標籤:mysql資料庫最佳化1、查詢最佳化 (1)避免where 子句中對欄位進行 null 值判斷 (2)避免在 where 子句中使用 or 來串連條件 (3)少使用like,如果要用可以考慮全文檢索索引 (4)in not in也會導致掃描全表,可以exist關鍵字 2、庫表最佳化(1)避免全表掃描,在where 和order by
標籤:時區簡單理解https://zh.wikipedia.org/wiki/%E6%97%B6%E5%8C%BA上面的連結是時區的wiki說明,下面說說我記住的部分:GMT時區是格林威治標準時間,我把它理解為 “真即時間”UTC時區是根據GMT得來的“世界標準時間”,它的時間和GMT是相同的CST可以指下列的時區:澳洲中部時間,Central Standard Time (Australia)中部標準時區(北美洲),Central
標籤:第一部分:基礎知識 索引 官方介紹索引是協助MySQL高效擷取資料的資料結構。筆者理解索引相當於一本書的目錄,通過目錄就知道要的資料在哪裡, 不用一頁一頁查閱找出需要的資料。唯一索引(unique index) 強調唯一,就是索引值必須唯一。建立索引:create unique index 索引名 on 表名(列名);alter table 表名 add unique index 索引名 (列名);刪除索引:drop index 索引名 on