#字段(field)基本上和列(column)的意思相同 SELECT Concat(vend_name, ' (', vend_country, ')') FROM vendors ORDER BY vend_name; #多数DBMS使用+或||来实现拼接,MySQL则使用Concat()函数来实现。 SELECT Concat(RTrim(vend_name), ' (', RTrim(vend_country), ')') FROM vendors ORDER BY vend_name; #RTrim()去掉值右边所有的空格,LTrim()和Trim()则分别表示去掉左边和左右两边的所有空格 SELECT Concat(RTrim(vend_name), ' (', RTrim(vend_country), ')') AS vend_titile FROM vendors ORDER BY vend_name; SELECT prod_id, quantity, item_price, quantity*item_price AS expanded_price From orderitems WHERE order_num = 20005; SELECT 3*2; SELECT Trim(' abc '); SELECT Now(); #用于测试计算结果
下表是MySQL算术操作符: