自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 start with....connect by...

select ... from tablename start with cond1 connect by cond2 where cond3; 简单说来是将一个树状结构存储在一张表里,比如一个表中存在两个字段: id,parentid那么通过表示每一条记录的parent是谁,就可以形成一个树状结构。 用上述语法的查询可以取得这棵树的所有记录。 其中COND1是根结点的限定语句,当然可以放宽限定条...

2011-02-26 21:43:46 77

原创 返回奇数行或者偶数行数据库表记录

--方法1用Decode函数for even number of recordsselect*from emp where rowid in(select decode(mod(rownum,2),0,rowid) from emp);for odd number of recordsselect*from emp where rowid in(select decode(mod(rownum...

2011-02-26 18:05:38 531

原创 Oracle Decode用法

from: http://www.adp-gmbh.ch/ora/sql/decode.htmldecode (expression, search_1, result_1)decode (expression, search_1, result_1, search_2, result_2)decode (expression, search_1, result_1, sear...

2011-02-26 17:58:58 66

原创 如何删除数据库表中相同记录

 如何删除表中相同的记录(比如相同的id,假设没有主键)--方法1 DELETE FROM EMP WHERE ROWID NOT IN(SELECT MAX(ROWID) FROM EMP GROUP BY EMPNO)--方法2DELETE FROM emp e WHERE ROWID NOT IN ( SELECT MIN(ROWID) FROM emp aWHERE e.emp...

2011-02-26 17:42:46 124

原创 rank() analytic function

As an analytic function, RANK computes the rank of each row returned from a query with respect to the other rows returned by the query, based on the values of the value_exprs in the order_by_clause....

2011-02-26 09:38:17 89

原创 不用max函数返回表中最大值或者最小值

返回Test表中字段num的最大值或者最小值(不用Max函数), 近为了好玩。:) --返回最大值select distinct num from Test where num not in( select lesser.num from Test as greater,Test as lesserwhere lesser.num<greater.num) --返...

2011-02-26 09:09:41 1178

原创 Oracle 笔记

1. rownum and rowid rownum是在得到结果集的时候产生的,用于标记结果集中结果顺序的一个字段,这个字段被称为“伪数列”,也就是事实上不存在的一个数列。它的特点是按顺序标记,而且是逐次递加的,换句话说就是只有有rownum=1的记录,才可能有rownum=2的记录。 和rownum相似,oracle还提供了另外一个伪数列:rowid。不过rowid和rownum...

2011-02-26 08:47:54 70

原创 rownum解析

摘自:http://tenn.iteye.com/blog/99339,仅供自学 在Oracle中,要按特定条件查询前N条记录,用个rownum就搞定了。 select * from emp where rownum <= 5 而且书上也告诫,不能对rownum用">",这也就意味着,如果你想用 select * from emp where rownum > 5 则...

2011-02-26 08:31:54 108

原创 Oracle索引

一,oracle的索引陷阱一个表中有几百万条数据,对某个字段加了索引,但是查询时性能并没有什么提高,这主要可能是oracle的索引限制造成的。 oracle的索引有一些索引限制,在这些索引限制发生的情况下,即使已经加了索引,oracle还是会执行一次全表扫描,查询的性能不会比不加索引有所提高,反而可能由于数据库维护索引的系统开销造成性能更差。 下面是一些常见的索引限制问题。 1、使用不等于...

2011-02-25 12:47:02 57

原创 JDK中用到的设计模式

1. java.io 中用到了装饰模式和适配器模式装饰模式,In general, each read request made of a Reader causes a corresponding read request to be made of the underlying character or byte stream. It is therefore advisable to...

2011-02-19 19:28:18 146

原创 JDK小知识

1. java文件编译时可以通过指定 -source 1.4选择用JDK 1.4编译源文件。这在系统只装了JDK5或者6时比较有用。

2011-02-19 10:32:43 219

原创 cluster nad non-cluster index

There are clustered and nonclustered indexes. A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one cluster...

2011-02-10 15:00:48 156

原创 单例类

单例类中考虑到的有:1. 私有的构造函数2. static final 的instance域3.  多线程环境下,double check考虑4.  单例类如果实现了Serializable接口(直接或者间接),需要添加一个 readResolve() 方法,用instance域替换掉Serialization机制自动生成的实例类对象    private Object r...

2011-02-09 20:10:11 60

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除