易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle 视频笔记1(select)

下面是用scott用户测试的。
如果不知道当前用户是什么用户,可以输入: show user ,这样它就显示出当前用户是什么用户了.
如果想编辑已经输入到sqlplus中的代码,可以输入“ed”,然后回车就能弹出一个记事本,记事本里面有上一步输入的代码,修改代码并保存后关闭记事本,最后在sqlplus中输入“/”并击回车就执行了。
1.不等于号是:<>
如:select ename, sal from emp where deptno <> 10;
2.SQL中的字符串大小写不一样
如:select ename ,sal from emp where ename = 'CLASD';
与 select ename ,sal from emp where ename = 'clasd';
是不一样的.
3.between 与 >=和<=
如: select ename, sal from emp where sal between 800 and 1500; 的意思与
select ename, sal from emp where sal >= 800 and sal <= 1500; 一样
4.把空值选出来
如: select ename, sal, comm from emp where comm is null;
5.把非空值选出来
如: select ename, sal, comm from emp where comm is not null;
6.in的用法
如:select ename, sal, comm from emp where sal in (800, 1500, 2000); 意思是把sal等于800 或者1500或者2000的 ename、sal、comm 拿出来。
select ename, sal, comm from emp where sal not in (800, 1500, 2000); 意思是把sal不等
800或者1500或者2000的ename、sl、comm 拿出来。
7.日期:1981年2月20日以后的表示为: select ename, sal, hiredate from emp where hiredate > '20-2月-81'; 或:select ename, sal, hiredate from emp where hiredate > '20-2月-1981';
先转换格式再取日期与时间:select ename, hiredate from emp where hiredate > to_date('1981-2-20 12:34:56', 'YYYY-MM-DD HH24:MI:SS');
8.或者的连接用"or"
如:select ename, sal, comm from emp where sal>1000 or deptno=10;
9.模糊查找:like表示模糊查找,"%"表示零个或多个字母,"_"代表一个字母.
如:select ename from emp where ename like '%ALL%'; 表示查找符合ALL前面和后面有零个或多 个字母的ename;
select ename from emp where ename like '_A%';表示查找符合每二个字母是A的ename;
查找带有%的字符串,用转义字符"\",如:select ename from emp where ename like '%\%%';表示查找 带有"%"的字符串。也可以自己设置 转义字符,如:select ename from emp where ename like '%$%' escape '$'; 表


相关文档:

oracle 表空间操作

oracle表空间操作详解
  1
  2
  3作者:   来源:    更新日期:2006-01-04 
  5
  6 
  7建立表空间
  8
  9CREATE TABLESPACE data01
 10DATAFILE '/ora ......

Oracle所有版本汇总

找到一个介绍oracle版本的文章。
http://wapedia.mobi/en/Oracle_Database#3. 
■1979: Larry Ellison and friends founded Software Development Laboratories. 
■1979: SDL changed its company-name to "Relational Software, Inc." (RSI) and introduced its product Oracle V2 as an early commercially ......

ORACLE ORDER BY用法总结

今天在逛论坛的时候看到shiyiwan同学写了一个很简单的语句,可是order by后面的形式却比较新颖(对于我来说哦),以前从来没看过这种用法,就想记下来,正好总结一下ORDER BY的知识。
1、ORDER BY 中关于NULL的处理
缺省处理,Oracle在Order by 时认为null是最大值,所以如果是ASC升序则排在最后,DESC降序则排在最前。
......

ORACLE常用FAQ

 第一部分、SQL&PL/SQL
[Q]怎么样查询特殊字符,如通配符%与_
[A]select * from table where name like 'A_%' escape ''
[Q]如何插入单引号到数据库表中
[A]可以用ASCII码处理,其它特殊字符如&也一样,如
insert into t values('i'||chr(39)||'m'); -- chr(39)代表字符'
或者用两个单引号表示一个
or ......

Oracle 语句优化30个规则(上)

1. 选用适合的Oracle优化器
  Oracle的优化器共有3种:
  a. RULE (基于规则)
  b. COST (基于成本)
  c. CHOOSE (选择性)
  设置缺省的优化器,可以通过对init.ora文件中OPTIMIZER_MODE参数的各种声明,如RULE,COST,CHOOSE,ALL_ROWS,FIRST_ROWS . 你当然也在SQL句级或是会话(session)级对其进行覆盖。 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号