Oracle数据库select语句
select * from EMp--all data in EMP table
select * from EMP where ename in('SMITH')--the data where ename is SNITH in the EMP table
select ename||'is a' as INAME from EMP where eNAME = 'SMITH'--rename ENAME pius 'is a' to INAME
select sal || '_'||ename as employees from emp --sal plus ename to employees
select distinct sal from emp--delete the same rows
select * from emp order by sal desc--show the all data in the sal's data to up order
select * from emp where hiredate = '03-12月-81'--show the data when the hiredate is '1981-12-03'
select *from emp
where sal between 1100 and 3000 --select the data of sal 1100 to 3000
select * from emp
where deptno in (10,20)--where the deptno is 10 or 20
select * from emp where ename like '%_'--maybe
select * from emp where comm is null--nothing
select * from emp where lower (ename) = 'smith' -- change the word to lowercase
select initcap(ename) from (select lower(ename) as ename from emp)--change the first letter to capital
select concat('hello ','world')from dual--attach the two word
select substr('goodgoodstudydaydayup',5,9)from dual--cut nine letter start for five from the words
select length('goodgoodstudydaydayup')from dual--how many letter in the words
select instr('goodgoodstudydaydayup','s')from dual--the index of the letter 's' in the words
select lpad('goodgoodstudydaydayup',30,'-')from dual--make the words has 30 letters with the assignation words in the end,others fill in '-'
select rpad('goodgoodstudydaydayup',30,'-')from dual--make the words has 30 letters with the assignation words in the beginning,others fill in '-'
select trim('p' from 'goodgoodstudydaydayup')from dual--delete the letter 'p' from the starting or the end of the words
select round(3.1415926535,4)from dual--retention 4 decimal point with rounding of the number
select trunc(3.1415926535,4)from dual--cut 4 decimal point from the number
select mod(10,3)from dual --get the remainder
select sysdate from dual--get the currentdate of the system
select hiredate+5 from emp--the date plus 5,result is new date
select months_between('01-8月-95','11-7月-94')from dual--the defference of the two date
select add_months('01-7月-90',7)from dual--the date add to 7 months
select * from emp order by sal desc--descending order
select next_day(sysdate,'星期一')from dual--the date of the next monday
select last_day(sysdate)from dual--the last day of the month of the assignation date
select replace('goodgoodstudydaydayup','d','y')from dual--replace 'd' to 'y'
select to_char(sysdate,'yyyy')from dual--the year of currentdate
select to_char(sysdate,'fmyyy-mm-dd')from dual--format the system date to year-month-day
select to_char(sal,'$999,999,999')from emp--format the currency
select to_number('')+to_number('')from dual--transform varchar to number
select to_date('','yyyymmdd')from dual--transform from varchar to date
select *from emp where hiredate = last_day(hiredate)-2--reciprocal 3 days
select *from emp where hiredate <= add_months(sysdate,-25*12)--25years ago
select initcap(concat('dear',ename)) from emp--the front of all ename add to 'dear',the change the first letter to capital
select * from emp where length(ename) = 5--whose the length of name is 5
select *from emp where ename not like ('%R%')--whose name without the letter 'R'
select substr(ename,0,1) from emp --select the first letter of name
注:每个Select后为一个单独语句,需在结束后加分号“ ; ”,否则无法一起运行
Oracle数据库select语句的更多相关文章
- ORACLE数据库SQL语句的执行过程
SQL语句在数据库中处理过程是怎样的呢?执行顺序呢?在回答这个问题前,我们先来回顾一下:在ORACLE数据库系统架构下,SQL语句由用户进程产生,然后传到相对应的服务端进程,之后由服务器进程执行该SQ ...
- Oracle数据库基本语句练习
以ORACLE数据库为主提纲:第一部分.SQL语言基础 第一章:Oracle命令类别及sql简单语法介绍第二章:oracle的基本函数第三章:oracle的数据类型第四章:多表连接技术 第二部分.or ...
- Oracle中Select语句完整的执行顺序
oracle Select语句完整的执行顺序: .from 子句组装来自不同数据源的数据: .where 子句基于指定的条件对记录行进行筛选: .group by子句将数据划分为多个分组: .使用聚集 ...
- Oracle 查询(SELECT)语句(一)
Ø 简介 本文介绍 Oracle 中查询(SELECT)语句的使用,在 SQL 中 SELECT 语句是相对内容较多的,也是相对比较复杂一点的,所以这里拿出来单独学习. 首先,我们先来理一下思路,我 ...
- MySQL数据库select语句的使用方法
select语句可 以用回车分隔 $sql="select * from article where id=1"和 $sql="select * from article ...
- Oracle数据库的语句级读一致性
数据库:Oracle 前提:假定100万行的记录,在最后一行有一个数据a=1. 实验:你在9:00的时候查找数据,9:05的时候查到最后一行:但是,在9:01的时候有人修改了最后一行数据并提交(com ...
- oracle数据库常用语句
--查看数据库版本-- select * from product_component_version; -- 查看dbf存放位置 select * from dba_data_files; -- 查 ...
- Oracle数据库SQL语句操作大全汇总
数据库各个表空间增长情况的检查: SQL >SELECT A.TABLESPACE_NAME,( 1-(A.TOTAL)/B.TOTAL)* 100 USED_PERCENT FROM (SEL ...
- Oracle数据库SQL语句的分类
1986年10月,美国国家标准协会对SQL进行规范后,以此作为关系式数据库管理系统的标准语言,1987年在国际标准组织的支持下成为国际标准.不过各种通行的数据库系统其实在实践过程中都对SQL规范的作了 ...
随机推荐
- ALV打印模板(存代码)
*&---------------------------------------------------------------------* *& Report ZMMF013 * ...
- InnoDB支持的最大事务数量
Innodb存储引擎有rollback segment,每个rollback segment中记录了1024个undo log segment,在每个undo log segment中进行undo页的 ...
- @GeneratedValue 四种标准用法为TABLE,SEQUENCE,IDENTITY,AUTO.
一.JPA通用策略生成器 通过annotation来映射hibernate实体的,基于annotation的hibernate主键标识为@Id, 其生成规则由@GeneratedValue设定的.这里 ...
- learning ddr3 protocol
refercece: www.jedec.org https://www.cnblogs.com/zhongguo135/p/8486979.html :
- ubuntu compile openjdk87
0. use oracle JDK,not OpenJDK 1. 遇到错误Error:./gamma: relocation error: /usr/lib/jvm/java-7-openjdk-am ...
- Saiku二次开发获取源代码在本地编译(五)
关于Saiku的二次开发,在本地编译然后启动自己编译好的Saiku服务 Saiku是开源的,从github上能下载源代码,本例中的saiku源码也是从github上找的,然后自己改了一些pom.xml ...
- windows添加PDF虚拟打印机
添加PDF虚拟打印机(果真姜还是老的辣,我摸索了两天没结果的事情,大佬轻轻松松两分钟搞定...) 这种PDF虚拟打印机的功能是将需要被打印的内容写到当前系统的指定目录下的指定文件中.整个过程都不需要连 ...
- 【转载】JVM系列二:GC策略&内存申请、对象衰老
JVM里的GC(Garbage Collection)的算法有很多种,如标记清除收集器,压缩收集器,分代收集器等等,详见HotSpot VM GC 的种类 现在比较常用的是分代收集(generatio ...
- 《Python》常用模块之collections模块
内置的数据类型: int float complex str list tuple dict set 基础数据类型: int float complex str list tuple ...
- Cracking The Coding Interview4.8
//You are given a binary tree in which each node contains a value. Design an algorithm to print all ...