SQL Fundamentals: Using Single-Row Functions to Customize Output使用单行函数自定义输出
SQL Fundamentals || Oracle SQL语言
DUAL is a public table that you can use to view results from functions and calculations.
The DUAL table is owned by the user SYS and can be accessed by all users.
It contains one column, DUMMY, and one row with the value X.
SQL Fundamentals || Single-Row Functions || 字符函数 character functions
SQL Fundamentals || Single-Row Functions || 数字函数number functions
SQL Fundamentals || Single-Row Functions || 日期函数date functions
SQL Fundamentals || Single-Row Functions || 转换函数 Conversion function
SQL Fundamentals || Single-Row Functions || 通用函数 General function
Using Single-Row Functions to Customize Output
Oracle SQL supplies a rich library of in-built functions which can be employed for various tasks. The essential capabilities of a functions can be the case conversion of strings, in-string or substring operations, mathematical computations on numeric data, and date operations on date type values. SQL Functions optionally take arguments from the user and mandatorily return a value.
- Describe various types of functions available in SQL
- Use character, number, and date functions in SELECT statements
字符、数字、日期函数
1、SQL Functions

Functions are a very powerful feature of SQL. They can be used to do the following:
|
Perform calculations on data |
执行数据计算 |
|
Modify individual data items |
修改单独的数据项 |
|
Manipulate output for groups of rows |
操纵行组的输出 |
|
Format dates and numbers for display |
格式化日期和数字进行显示 |
|
Convert column data types |
转换列数据类型 |
SQL functions sometimes take arguments and always return a value.
SQL有时候接收参数并总是返回一个值.
2、Two Types of SQL Function:

|
Single-row functions |
单行函数 These functions operate on single rows only and return one result per row. 单行函数只操作单个行并为每一行返回一个结果. - Single row functions are the one who work on single row and return one output per row. For example, length and case conversion functions are single row functions. |
|
Multiple-row functions |
多行函数 - Multiple row functions work upon group of rows and return one result for the complete set of rows. They are also known as Group Functions. |
3、Single-row functions单行函数
Single row functions
Single row functions can be character functions, numeric functions, date functions, and conversion functions. Note that these functions are used to manipulate data items. These functions require one or more input arguments and operate on each row, thereby returning one output value for each row. Argument can be a column, literal or an expression. Single row functions can be used in SELECT statement, WHERE and ORDER BY clause.
Single-row functions are used to manipulate data items. They accept one or more arguments and return one value for each row that is returned by the query.
(1)特点
|
Manipulate data items |
操作数据项 |
|
Accept arguments and return one value |
接收参数并返回一个值 |
|
Act on each row that is returned |
每一行进行操作 |
|
Return one result per row |
每一行返回一个值 |
|
Many modify the data type |
单行函数可以修改数据类型 |
|
Can be nested |
单行函数可以嵌套 |
|
Accept arguments that can be a column or an expression An argument can be one of the following:
|
函数接收的参数可以是列名或者表达式
|
(2)、语法
Function_name [(arg1,arg2….)]
(3)、类型

|
字符函数 character functions |
Accept character input and can return both character and number values. |
|
数字函数 number functions |
Accept numeric input and return numeric values. |
|
日期函数 date functions |
Operate on values of the DATE data type (All date functions return a value of the DATE data type except the MONTHS_BETWEEN function, which returns a number) 所有日期函数都返回一个DATE类型的值,除了MONTHS_BETWEEN函数,它返回一个数字. |
|
转换函数 Conversion function |
Convert a value from one data type to another |
|
通用函数 General function |
NVL:对空值做处理 NVL2:对空值做处理 NULLIF:对空值做处理 COALESCE CASE DECODE General functions The SELECT query below demonstrates the use of NVL function. SELECT first_name, last_name, salary, NVL (commission_pct,0) FIRST_NAME LAST_NAME SALARY NVL(COMMISSION_PCT,0) |
SQL Fundamentals: Using Single-Row Functions to Customize Output使用单行函数自定义输出的更多相关文章
- Oracle SQL Lesson (3) - 使用单行函数自定义输出
大小写转换函数LOWER('SQL Course') = sql courseUPPER('SQL Course') = SQL COURSEINITCAP('SQL Course') = Sql C ...
- SQL Fundamentals || Single-Row Functions || 转换函数 Conversion function
SQL Fundamentals || Oracle SQL语言 SQL Fundamentals: Using Single-Row Functions to Customize Output使 ...
- SQL Fundamentals || Single-Row Functions || 字符函数 character functions
SQL Fundamentals || Oracle SQL语言 SQL Fundamentals: Using Single-Row Functions to Customize Output使 ...
- SQL Fundamentals || Single-Row Functions || 通用函数 General function || (NVL,NVL2,NULLIF,DECODE,CASE,COALESCE)
SQL Fundamentals || Oracle SQL语言 SQL Fundamentals: Using Single-Row Functions to Customize Output使用单 ...
- SQL Fundamentals || Single-Row Functions || 日期函数date functions
SQL Fundamentals || Oracle SQL语言 SQL Fundamentals: Using Single-Row Functions to Customize Output使 ...
- SQL Fundamentals || Single-Row Functions || 数字函数number functions
SQL Fundamentals || Oracle SQL语言 SQL Fundamentals: Using Single-Row Functions to Customize Output使用单 ...
- SQL Fundamentals || Oracle SQL语言
对于SQL语言,有两个组成部分: DML(data manipulation language) 它们是SELECT.UPDATE.INSERT.DELETE,就象它的名字一样,这4条命令是用来对数据 ...
- 微软BI 之SSIS 系列 - Execute SQL Task 中的 Single Row 与 Full Result Set 的处理技巧
开篇介绍 Execute SQL Task 这个控件在微软BI ETL 项目中使用的频率还是非常高的,也是大部分入门 SSIS 初学者最早接触到的几个控制流控件. 我们通常使用 Execute SQL ...
- SQL Fundamentals: Basic SELECT statement基本的select语句(控制操作的现实列)(FROM-SELECT)
SQL Fundamentals || Oracle SQL语言 Capabilities of the SELECT Statement(SELECT语句的功能) Data retrieval fr ...
随机推荐
- Elastic-Job原理分析(version:2.1.4)
当当的Elastic-Job开源出了两种分布式Job的解决方案:1. elastic-job-lite,这是一个无中心节点的调度: Elastic-Job-Lite定位为轻量级无中心化解决方案,使用j ...
- MongoDB的数据模型
文档的数据模型代表了数据的组织结构,一个好的数据模型能更好的支持应用程序.在MongoDB中,文档有两种数据模型,内嵌(embed)和引用(references). 内嵌 MongoDB的文档是无模式 ...
- css后台页面布局技巧
目标: 实现左边侧边栏固定,右边内容区自适应 侧边栏内容较少时背景100%高度展示 侧边栏内容较多时可以滚动,且不让显示滚动条(显示太丑) 内容区较少时不出现滚动条,较多时可以滚动 code: < ...
- hive-数据模型
hive支持四种数据模型 • external table• table• partition• bucket 为了避免table名称冲突,hive用database作为顶层域名,如果不设定datab ...
- 免费SVN、Git项目托管主机推荐
Unfuddle 200MB的免费空间,界面友好,特性丰富,支持Git,但只能一个账户一个用户并且只允许一个项目,付费服务相对来说价格偏高 CodeSpaces 500MB,一个账户两个免费用户,付费 ...
- vue再次入手(数据传递①)
准备 之前使用vue.js完成一个项目之后,对其还是充满着无限兴趣,于是不妨利用碎片时间再次研究一下这个“令人着迷”的js框架. 1.新建一个基于vue的项目,具体方法不再赘述,请看这里:http:/ ...
- iOS - App Extension 整体总结
一.App Extension的介绍 App Extension可以让你扩展你APP的自定义功能和内容,使用户可以在与其他应用或者系统进行互动的时候去使用它.app extension即为本文所说的e ...
- Android学习之位图BitMap
BitMap代表一张位图,扩展名可以是.bmp或者.dib.位图是Windows标准格式图形文件,它将图像定义为由点(像素)组成,每个点可以由多种色彩表示,包括2.4.8.16.24和32位色彩.例如 ...
- 模型提升方法adaBoost
他通过改变训练样本的权重,学习多个分类器,并将这些分类器进行线性组合,提高分类的性能. adaboost提高那些被前一轮弱分类器错误分类样本的权重,而降低那些被正确分类样本的权重,这样使得,那些没有得 ...
- 解决Ubuntu刚装好的时候su命令密码错误的问题
Ubuntu刚安装后,在terminal中运行su命令会要求输入密码,然而无论输什么都会错,直接回车也是错,这因为root没有默认密码,需要手动设定.以安装ubuntu时输入的用户名登陆,该用户在ad ...