Monday, September 3, 2012

challenging Queries

table t has 1 column year :

t:

1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005

select min(year),max(year) from t returns :
1994 2005

how to display all the year s without using a select * from query?

select(select min(year) from t +rownum-1 
from all_objects) 
where rownum<=
      (select max(year) -min(year)+1from  t);


No comments:

Post a Comment