[intersect:相交]
select ename,sal,comm from emp where sal>1300
INTERSECT
select ename,sal,comm from emp where comm is not null
===select ename,sal,comm from emp where sal>1300 and comm is not null
ENAME SAL COMM
---------- --------- ---------
ALLEN 1600 300
TURNER 1500 0
------------------------------
[minus]
select ename,sal comm from emp where sal>1300
minus
select ename,sal comm from emp where sal>1500;
===select ename,sal,comm from emp where sal>1300 and not(sal>1500)
ENAME COMM
---------- ---------
TURNER 1500
--------------------
select to_char(sysdate,\'yyyy/mm/dd hh24:mi\') sys_date from dual;
select to_date(\'2002/08/13\',\'yyyy/mm/dd\') from dual;
select to_number(\'12345\',99999) from dual;
select empno,ename from emp where months_between(sysdate,hiredate)>=12;
add_months(date,number)
last_day(date)
months_between(date1,date2)
next_dat(date,day)
round(date,format)
trunc(date,format)
----------------------------------------------------------------------------
数值函数
abs(number)
ceil(number)
cos(number)
ln(number)
mod(n,m)
round(number,decimal_digits)
sign(number)
sqrt(number)
sin(number)
-------------------
字符函数
ascii(character)
chr(number)
concat(string1,string2) #|| 连接两个字段
initcap(string)
length(string)
lower(string) upper(string)
substr(string,start[,length])
replace(string,search_string,replace_string)
-------------------
other
greatest(list of values)
least(list of values)
nvl(expression,replacement_value)
AVG(expression)
COUNT(expression)
MAX(expression)
MIN(expression)
SUM(expression)
Welcome>select count(*),sum(sal),avg(sal),max(sal),min(sal) from emp;
COUNT(*) SUM(SAL) AVG(SAL) MAX(SAL) MIN(SAL)
最近在用oracle数据库,突击学习了一些相关的sql语句:
相关文章:
- Oracle数据库基本语句练习 2021-12-09
- ORACLE数据库操作基本语句 2021-12-09
- ORACLE基本的sql语句 2022-12-23
- Oracle 创建本地数据库sql语句 2021-09-07
- 基于MySql数据库的基本sql语句 2021-12-04
- Oracle数据库1-sql语句 2021-12-09
- Oracle 基本SQL语句 2021-12-09
- oracle 基本sql语句 2021-10-16