select vend_name, Upper(vend_name) as vend_name_upcase from vendors order by vend_name
Left()
Lenght()
Locate()
Lower()
LTrim()
Right()
RTrim()
Trim()
Soundex()
-
select cust_name, cust_contact from customers where cust_contact = 'Y. Lie'
-
发音相似的列:
select cust_name, cust_contact from customers where Soundex(cust_contact) = Soundex ( 'Y. Lie');
日期函数
-
select cust_id, order_num from orders where order_data = '2007-09-01'
order_date的数据类型是datetime, 计入数据库中存储的是order_data : '2007-09-01 39: 34:12'`,该如何匹配呢? -
select cust_id, order_num from orders where Date(order_data) = '2007-09-01'
-
检索2005年9月的所有订单
select cust_id, order_num from orders where Date(order_data) between '2005-09-01' and '2005-09-30';
select cust_id, order_num from orders where Year(order_data) = 2005 and Month(order_date) = 9;