oracle sql学习

2014-11-24 09:03:25 · 作者: · 浏览: 0

Sql代码

select mc || '白痴' as 别名,nl+20 as 年龄 from student;

sql中 字符串和日期必须被单引号('')包括。

sql中 数字和日期可以使用 加、减、乘、除(+、-、*、/).

sql中 字符串可以使用‘||’来连接。

sql中 使用as otherName 来定义字段的别名。

Sql代码

select distinct department_id from employess;

sql中distinct 关键字 可以用来删除重复行。

select 语句的过滤

各个比较运算符之间的优先级

Sql代码

select * from employess

where job_id = 'SA_REP'

job_id = 'AD_PERS'

salary > 15000;

--等效于

select * from employess

where job_id = 'SA_REP' or job_id = 'AD_PERS' and salary > 15000;

两个优先级相同的 表达式 中间的关系是'or',

不同优先级的表达式 中间的关系是'and'。

oracle 的函数

大小写函数

字符串控制函数

其中instr 如果只有一个显示的是位置,一个以上显示的是个数。

数字函数

日期函数