mysql update upper_MySQL数据处理函数upper、abs、date
1. 數據處理函數
文本處理函數
upper()轉換大寫函數
SQL> select vend_name, upper(vend_name) as vend_name_upcase from vendors order by vend_name;
soundex()發(fā)音類似函數
SQL> select cust_name, cust_contact from customers where cust_contact = 'Y. Lie';
SQL> select cust_name, cust_contact from customers where soundex(cust_contact) = soundex('Y. Lie');
日期篩選
精確查找(默認00:00:00)
SQL> select cust_id, order_num from orders where order_date = '2005-09-01';
常規(guī)查找(忽略時分秒)
SQL> select cust_id, order_num from orders where date(order_date) = '2005-09-01';
日期區(qū)間查詢
通過區(qū)間設定
SQL> select cust_id, order_num from orders where date(order_date) between '2005-09-01' and '2005-09-30';
通過年月設定
SQL> select cust_id, order_num from orders where year(order_date) = 2005 and month(order_date) = 9;
數值處理函數
1. 常用文本處理函數
left() 返回串左邊的字符
length() 返回串的長度
locate() 找出串的一個子串
lower() 將串轉換為小寫
ltrim() 去掉串左邊的空格
right() 返回串右邊的字符
rtrim() 去掉串右邊的空格
soundex() 返回串的SOUNDEX值
subString() 返回字串的字符
upper() 將串轉換為大寫
2. 日期和時間處理函數
日期通常為yyyy-mm-dd格式
addDate() 增加一個日期(天、周等)
addTime() 增加一個時間(時、分等)
curDate() 返回當前日期
curTime() 返回當前時間
date() 返回日期時間的日期部分
dateDiff() 計算兩個日期之差
date_Add() 高度靈活的日期運算函數
date_Format() 返回一個格式化的日期或時間串
day() 返回一個日期的天數部分
dayOfWeek() 對應一個日期,返回對應的星期幾
year() 返回一個時間的年份部分
mouth() 返回一個時間的月份部分
hour() 返回一個時間的小時部分
minute() 返回一個時間的分鐘部分
second() 返回一個時間的秒部分
time() 返回一個日期時間的時間部分
now() 返回當前日期和時間
3. 數值處理函數
abs() 返回一個數的絕對值
cos() 返回一個角度的余弦
exp() 返回一個數的指數值
mod() 返回數操作的余數
pi() 返回圓周率
rand() 返回一個隨機數
sin() 返回一個角度的正弦
sqrt() 返回一個數的平方根
tan() 返回一個角度的正切
分享到:
2018-09-17 22:28
瀏覽 439
分類:數據庫
評論
總結
以上是生活随笔為你收集整理的mysql update upper_MySQL数据处理函数upper、abs、date的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java sql2008的增删改查_SQ
- 下一篇: oracle非常量不能用于privot_