1. 年月日:如2014-04-25 08:00:00mysql
截取時間中的日:取出來25,sql
可使用date_format這個函數取,如圖:數據庫
2. concat( a,b ,c);centos
3. replace( string, 'a', 'aaaaa');函數
4.substr substringspa
substring(str, pos)
substring(str, pos, length)
說明:substring(被截取字段,從第幾位開始截取)
substring(被截取字段,從第幾位開始截取,截取長度)
例:select substring(content,5) as abstract from my_content_t
select substring(content,5,200) as abstract from my_content_t
(注:若是位數是負數 如-5 則是從後倒數位數,到字符串結束或截取的長度)3d
5. mysql -h 172.16.16.45 -P 3306 -u root -p123code
6. centos mysql 中文存儲亂碼 --------------------- 修改: /etc/my.cnf default_character_set=utf8orm
select date_add('2018-06-26',INTERVAL '5' day);
USE information_schema;
blog
-- Mysql 一個數據庫全部有數據的表
SELECT
table_schema,table_name,table_rows
FROM
TABLES
WHERE
TABLE_SCHEMA=
'test'
AND
table_rows != 0
ORDER
BY
table_rows
DESC
;
-- Mysql 一個數據庫中全部爲空的表
SELECT
table_schema,table_name,table_rows
FROM
TABLES
WHERE
TABLE_SCHEMA=
'test'
AND
table_rows = 0
ORDER
BY
table_name ;