We provide simple language & easy understandable notes for IT students. Not only IT students for others We will post helpful things. Our authors are trying to help you in IT subjects, you are requested to comment for the same.
Search...
Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts
Thursday, October 15, 2015
Saturday, April 4, 2015
SQL Queries
1.
To
fetch ALTERNATE records from a table. (EVEN NUMBERED)
select * from emp
where rowid in (select decode(mod(rownum,2),0,rowid, null) from emp);
2.
To
select ALTERNATE records from a table. (ODD NUMBERED)
select * from emp
where rowid in (select decode(mod(rownum,2),0,null ,rowid) from emp);
3.
Find
the 3rd MAX salary in the emp table.
select distinct sal
from emp e1 where 3 = (select count(distinct sal) from emp e2 where e1.sal
<= e2.sal);
4.
Find
the 3rd MIN salary in the emp table.
select distinct sal
from emp e1 where 3 = (select count(distinct sal) from emp e2where e1.sal >=
e2.sal);
5.
Select
FIRST n records from a table.
select * from emp
where rownum<= &n;
Sunday, December 21, 2014
Free Download SQL The Complete Reference 3rd Edition
Title : SQL The Complete Reference
Author(s) : James R Groff, Paul N. Weinberg, Andy Oppel
Edition : 3rd Edition
Subscribe to:
Posts (Atom)