Skip to main content

Posts

Showing posts with the label Examples of Sql complex select queries

Examples of Sql complex select queries

Examples of Sql complex select queries select count(MGR),count(sal) from salesmans; select ename,(sal+nvl(comm,0)) as totalsal from salesmans; select * from salesmans where sal> any(select sal from salesmans where sal<3000); select * from salesmans where sal> all(select sal from salesmans where sal<3000); select ename,deptno,sal from salesmans order by deptno,sal desc; Create table salesmans1 as select * from salesmans where 1=2; Select * from salesmans where sal>=1000 And sal<2000; select * from salesmans where rowid in (select decode(mod(rownum,2),0,rowid, null) from salesmans); select * from salesmans where rowid in (select decode(mod(rownum,2),0,null ,rowid) from salesmans); select * from dept where deptno not in (select deptno from salesmans); select * from dept a where not exists (select * from salesmans b where a.deptno = b.deptno); select salesmansno,ename,b.deptno,dname from salesmans a, dept b where a.deptno(+) = b.deptno