- 2
- 0
- 约2.14万字
- 约 20页
- 2017-06-05 发布于湖北
- 举报
* SQL常用函数:
数值函数:
* ABS
Purpose 返回绝对值
Returns the absolute value of n.
Example
SELECT ABS(-15) Absolute FROM DUAL;
Absolute
15
* CEIL
Purpose 取最小整数
Returns smallest integer greater than or equal to n.
Example
SELECT CEIL(15.7) Ceiling FROM DUAL;
Ceiling
16
* MOD
Syntax
MOD(m,n)
Purpose 取余
Returns remainder of m divided by n. Returns m if n is 0.
Example
SELECT MOD(11,4) Modulus FROM DUAL;
Modulus
3
* ROUND
Syntax
ROUND(n[,m])
Purpose 取四舍五入信息
Returns n rounded to m places right of the decimal point; if m is omitted, to 0 places. m can be negative to round off digits left of the decimal point. m must be an integer.
Example 1
SELECT ROUND(15.193,1) Round FROM DUAL;
Round
15.2
Example 2
SELECT ROUND(15.193,-1) Round FROM DUAL;
Round
20
?
* TRUNC
Purpose 取截取后的信息
Returns n truncated to m decimal places; if m is omitted, to 0 places. m can be negative to truncate (make zero) m digits left of the decimal point.
Examples
SELECT TRUNC(15.79,1) Truncate FROM DUAL;
Truncate
15.7
SELECT TRUNC(15.79,-1) Truncate FROM DUAL;
Truncate
10
字符函数:
* CONCAT
Syntax
CONCAT(char1, char2)
Purpose 合并字符串,相当于“||”
Returns char1 concatenated with char2. This function is equivalent to the concatenation operator (||). For information on this operator, see Concatenation Operator.
Example
This example uses nesting to concatenate three character strings:
SELECT CONCAT( CONCAT(ename, is a ), job) Job
FROM emp
WHERE empno = 7900;
Job
JAMES is a CLERK
?
* LOWER
Purpose 变为小写
Returns char, with all letters lowercase. The return value has the same datatype as the argument char (CHAR or VARCHAR2).
Example
SELECT LOWER(MR. SCOTT MCMILLAN) Lowercase
FROM DUAL;
Lowercase
mr. scott mcmillan
* LPAD
Purpose 左填充
Returns char1, left-padded to length n with the sequence of characters in char2; char2 defaults to a single blank. If char1 is longer than n, this function returns the port
您可能关注的文档
最近下载
- (正式版)DB1501∕T 0038-2023 《红花生态种植技术规程》.pdf VIP
- 2025年广东中山中考语文试题及答案(word版) .pdf VIP
- 《中国文化概论》张岱年课后习题答案.pdf VIP
- 德阳市中考:2025年-2023年《化学》考试真题与参考答案.pdf
- 公路平面交叉设计细则.docx VIP
- 人教版二年级下册数学全册教学设计(配2026年春改版教材).docx
- 智慧树 知到 大学生爱国教育十讲 章节测试答案.docx VIP
- 2024年广东中山中考语文试题及答案.pdf VIP
- 医院药品采购管理制度细则.docx VIP
- 2《JavaScript初级》教学计划大纲.docx VIP
原创力文档

文档评论(0)