mysql中concat、RTrim、LTrim、Trim、AS
1.concat:拼接函数,可以将几个字符按照设定的格式进行拼装;
如:select concat(vend_name, ' (', vend_country, ')') from vendors ORDER BY vend_name;
+--------------------------------------------+ | concat(vend_name, ' (', vend_country, ')') | +--------------------------------------------+ | Anvils R Us (USA) | | ACME (USA) | | Furball Inc. (USA) | | Jet Set (England) | | Jouets Et Ours (France) | | LT Supplies (USA) | +--------------------------------------------+ 6 rows in set (0.00 sec)
2.RTrim:去右侧的空格;
LTrim:去左侧的空格
Trim:去两侧的空格;
如:select concat(Trim(vend_name), ' (', Trim(vend_country), ')') from vendors ORDER BY vend_name;
+--------------------------------------------------------+ | concat(Trim(vend_name), ' (', Trim(vend_country), ')') | +--------------------------------------------------------+ | Anvils R Us (USA) | | ACME (USA) | | Furball Inc. (USA) | | Jet Set (England) | | Jouets Et Ours (France) | | LT Supplies (USA) | +--------------------------------------------------------+ 6 rows in set (0.00 sec)
青青园中葵,朝露待日晞。
阳春布德泽,万物生光辉。
常恐秋节至,焜黄华叶衰。
百川东到海,何时复西归?
少壮不努力,老大徒伤悲!