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规范的作了 ...
随机推荐
- Grafana安装配置介绍
一.Grafana介绍 Grafana是一个可视化面板(Dashboard),有着非常漂亮的图表和布局展示,功能齐全的度量仪表盘和图形编辑器,支持Graphite.zabbix.InfluxDB.Pr ...
- InnoDB存储引擎介绍-(7) Innodb数据页结构
数据页结构 File Header 总共38 Bytes,记录页的头信息 名称 大小(Bytes) 描述 FIL_PAGE_SPACE 4 该页的checksum值 FIL_PAGE_OFFSET 4 ...
- [luogu P2319] [HNOI2006]超级英雄
[luogu P2319] [HNOI2006]超级英雄 题目描述 现在电视台有一种节目叫做超级英雄,大概的流程就是每位选手到台上回答主持人的几个问题,然后根据回答问题的多少获得不同数目的奖品或奖金. ...
- [Codeforces Round #340 (Div. 2)]
[Codeforces Round #340 (Div. 2)] vp了一场cf..(打不了深夜的场啊!!) A.Elephant 水题,直接贪心,能用5步走5步. B.Chocolate 乘法原理计 ...
- 如何解决Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a. 问题
在系统中需要把数据导出到excel并且压缩,然后报了这个问题: 我在网站上找到了方法: 地址:https://social.msdn.microsoft.com/Forums/vstudio/en-U ...
- 关于RabbitMQ服务器整合(二)
准备工作 15min IDEA maven 3.0 在开始构建项目之前,机器需要安装rabbitmq,你可以去官网下载,http://www.rabbitmq.com/download.html ,如 ...
- python图片识别
python 图像处理模块1. 安装 pytesseract模块是会自动安装Pillow模块.pillow 为标准图像处理库 手册地址 http://pillow-cn.readthedocs.io/ ...
- angular4,angular6中解决内层盒子到底外层盒子滚动
//用来处理 里盒子滚完外盒子滚的问题 scrollUnique(who){ document.getElementsByClassName(who)[0].addEventListener('mou ...
- python 自然语言处理(四)____词典资源
词典或者词典资源是一个词和/或短语及其相关信息的集合,例如:词性和词意定义等相关信息.词典资源附属于文本,而且通常在文本的基础上创建和丰富.下面列举几种nltk中的词典资源. 1. 词汇列表语料库 n ...
- U启动安装原版Win7系统教程
1.制作u启动u盘启动盘2.下载原版win7系统镜像并存入u盘启动盘3.硬盘模式更改为ahci模式 第一步: 将准备好的u启动u盘启动盘插在电脑usb接口上,然后重启电脑,在出现开机画面时通过u盘启动 ...