標籤:本周內:select * from wap_content where week(created_at) = week(now)查詢一天:select * from table where to_days(column_time) = to_days(now());select * from table where date(column_time) = curdate();查詢7天:select * from table where DATE_SUB(CURDATE(),
標籤:mysql在使用like查詢中,能不能用到索引?在什麼地方使用索引呢?在使用like的時候,如果使用‘%%’,會不會用到索引呢?EXPLAIN SELECT * FROM `user` WHERE username LIKE ‘%ptd_%‘; 上面的結果是全表掃描(type == ALL),並沒有使用到索引。 只是使用一個%的查詢結果:EXPLAIN SELECT * FROM `user` WHERE
標籤:WAMP安裝好後,mysql密碼是為空白的,那麼要如何修改呢?其實很簡單,通過幾條指令就行了,下面我就一步步來操作。 首先,通過WAMP開啟mysql控制台。 提示輸入密碼,因為現在是空,所以直接按斷行符號。 然後輸入“use mysql”,意思是使用mysql這個資料庫,提示“Database changed”就行。 然後輸入要修改的密碼的sql語句“update user set password=PASSWORD(‘
標籤:使用者和許可權管理Information about account privileges is stored in the user, db, host, tables_priv, columns_priv, and procs_priv tables in the mysql database. The MySQL server reads the contents of these tables into memory when it starts and
標籤:mysql中文亂碼解決方案:將mysql資料庫編碼統一utf8查看資料庫編碼:show variables like ‘character%‘; 編輯/etc/my.cnf[mysql]default-character-set=utf8[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to
標籤:(一)1、尋找表中多餘的重複記錄,重複記錄是根據單個欄位(peopleId)來判斷select * from peoplewhere peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1) 2、刪除表中多餘的重複記錄,重複記錄是根據單個欄位(peopleId)來判斷,只留有一個記錄delete from peoplewhere peopleId in (select