Answer Posted / asnani_satish@yahoo.com
Minor correction in above answer
Difference between sub-query, correlated query and query as
table
1. Sub-query : the inner query is executed in entirety
before the outer query is executed
eg select * from emp where deptno in (select deptno from dept);
2. Correlated Query: For each record fetched in outer query
corresponding matching records are fetched in sub-query
because of join condition within inner sub-query. Answers
1,2,3 are correct
3. Query as Table: A query can behave as a table
select a.empno,a.sal,a.sal/b.avgsal*100 as percent_avg_sal
from emp a,(select deptno,avg(sal) avgsal from emp group by
deptno) b
where a.deptno=b.deptno;
Here the entire "(select deptno,avg(sal).....)" behaves as
table named "b" containing dept wise average sal. The query
is behaving as a temporary table.
Is This Answer Correct ? | 6 Yes | 9 No |
Post New Answer View All Answers
Is there a pl/sql pragma similar to deterministic, but for the scope of one single sql select?
what is cursor. write example of it. What are the attributes of cursor.
Why sql query is slow?
How does one load ebcdic data? : aql loader
how to analyze tables with 'mysqlcheck'? : Sql dba
Can we use having without group by in sql?
What is column?
Is sql injection illegal?
What is a pl/sql block?
What is an implicit commit?
what is isam? : Sql dba
What is rank function in sql?
Write a sql select query that only returns each name only once from a table?
What is pls integer?
How to set up sql*plus output format in oracle?