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规范的作了 ...
随机推荐
- spring cloud服务发现注解之@EnableDiscoveryClient与@EnableEurekaClient
使用服务发现的时候提到了两种注解,一种为@EnableDiscoveryClient,一种为@EnableEurekaClient,用法上基本一致,今天就来讲下两者,下文是从stackoverflow ...
- 用vue构建多页面应用
最近一直在研究使用vue做出来一些东西,但都是SPA的单页面应用,但实际工作中,单页面并不一定符合业务需求,所以这篇我就来说说怎么开发多页面的Vue应用,以及在这个过程会遇到的问题. 准备工作 在本地 ...
- kiss word memory post poly peri out ~p 4
1● post p əust 在后面,邮件 2● peri 多 3● poly 周围,靠近
- sql server 根据身份证号计算出生日期和年龄的存储过程
我这边有一个业务,需要客户填写身份证号,自动计算他的出生日期和年龄 在sql中,具体的存储过程实现是这样的: /******************************************** ...
- ueeditor 百度编译器使用onchange效果
<script id="editor" type="text/plain" style="width:100%;height:200px;&qu ...
- 【Oracle安装卸载】oracle卸载
Oracle卸载比较麻烦,不能简单卸载就完成了,有时没有卸载完整,下次安装不能很好的安装: 当然Oracle卸载也没有那么难,只是步骤比较多.Oracle10g还是Oracle11g卸载步骤都是一样的 ...
- 【JAVA】关于向上转型与向下转型
向上转型: 子类引用的对象转换为父类类型称为向上转型.通俗地说就是是将子类对象转为父类对象.此处父类对象可以是接口 如果子类重写了父类的方法,就根据这个引用指向调用子类重写的这个方法,不是调用父类的, ...
- nginx+tomcat集群
参考: 简单:http://blog.csdn.net/wang379275614/article/details/47778201 详细:http://www.jb51.net/article/77 ...
- OOP⑷
1.对象数组: /** *学生类 */ public class Student { // 创建一个对象数组保存3名学生的信息 Student[] stus = new Student[3]; int ...
- 【原创】imread () 函数 读入图片的例子
Reference Links Opencv+ qt5.1 完美配置 - 脚踏实地 - 博客频道 - CSDN.NET http://blog.csdn.net/xiaojidan2011/arti ...