2014年3月流水账

1.文件迭代

       /**
	 * 得到更新时间点之后的所有文件列表
	 */
	private void getUpdateFiles(long updatePoint, File root,List<File> files){
		File[] _files = root.listFiles();
		if(_files!=null){
			for(File file : _files){
				if(file.isFile()&&isUpdateFile(updatePoint, file.lastModified())){
					files.add(file);
				}else if(file.isDirectory()){
					getUpdateFiles(updatePoint, file, files);
				}
			}
		}
	}

 

2.获得文件修改时间

	long newUpdateTime = f.lastModified();
        Calendar cal = Calendar.getInstance();
	cal.setTimeInMillis(newUpdateTime);
        cal.getTime();

 3.SQL:找出员工里连续三年工资都超过5%的员工  

 

CREATE table EMP

(

  NAMES       VARCHAR2(512) not null,

  PAYS      NUMBER(10) not null,

  YEARS     NUMBER(10) not null

);

 

insert into emp values('A',1000,2001);

insert into emp values('A',1200,2002);

insert into emp values('A',1500,2003);

insert into emp values('A',2000,2004);

insert into emp values('B',1000,2001);

insert into emp values('B',1005,2002);

insert into emp values('B',1100,2003);

insert into emp values('B',1200,2004);

insert into emp values('C',1000,2001);

insert into emp values('C',1000,2002);

insert into emp values('C',1001,2003);

insert into emp values('C',1002,2004);

 

SELECT T.NAMES FROM (
SELECT NAMES,PAYS,LAG(PAYS,1,0) OVER(PARTITION BY NAMES ORDER BY YEARS) AS PRE_VAL,YEARS FROM EMP_TEST
) T WHERE PRE_VAL<>0 AND  (PAYS-PRE_VAL)/PRE_VAL>0.05 group by t.names having count(*)>2;
 RESULT : A
ORACLE 函数:lag(),lead() 
http://blog.csdn.net/wanglipo/article/details/7105136

 

你可能感兴趣的:(流)