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规范的作了 ...
随机推荐
- SecureCRT自动记录日志
From: http://lzj0470.iteye.com/blog/1189368 今天在推特上看到有人谈起SecureCRT日志记录的问题,貌似很多人都有这习惯 我是开始工作后才使用Secure ...
- 2017-4-20/Redis的数据结构及应用场景
1. 谈谈你对redis的理解,它的应用场景. Redis是一个key-value存储系统,它支持存储的value类型包括string字符串.list链表.set集合.sorted Set有序集合和h ...
- python中几种循环体
条件判断与循环 1.条件判断 if <条件判断1>: <执行1> elif <条件判断2>: <执行2> elif <条件判断3>: < ...
- 用vue构建多页面应用
最近一直在研究使用vue做出来一些东西,但都是SPA的单页面应用,但实际工作中,单页面并不一定符合业务需求,所以这篇我就来说说怎么开发多页面的Vue应用,以及在这个过程会遇到的问题. 准备工作 在本地 ...
- C++ leetcode Longest Substring Without Repeating Characters
要开学了,不开森.键盘声音有点大,担心会吵到舍友.今年要当个可爱的技术宅呀~ 题目:Given a string, find the length of the longest substring w ...
- 牛客网 PAT 算法历年真题 1003: 数素数 (20)
1003:数素数 (20) 时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 令Pi表示第i个素数.现任给两个正整 ...
- Talend 数据转换
2个系统都有客户信息,产品信息. 要从一个系统a导出数据给另一个系统b用. 有2个方法. 1.在a系统的客户表,产品表加一个字段,记录b系统对应的ID,导出时直接用sql转换了. 2. 用ETL工具转 ...
- ci框架memcached使用
首先第一步需要安装memcached扩展 安装方法这里就不叙述了 application/config/memcached.php配置 $config = array( 'default' => ...
- 程序从sqlserver2008搬家到MySQL5.6
1.数据表结构的搬家 SqlServer的建表sql语句在MySQL中肯定不能运行 这里使用转换工具 下载地址: https://download.csdn.net/download/zhutouai ...
- 依赖倒置(DIP)、控制反转(IOC)和依赖注入(DI)
原文: https://blog.csdn.net/briblue/article/details/75093382 写这篇文章的原因是这两天在编写关于 Dagger2 主题的博文时,花了大量的精力来 ...