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
What is data control language (dcl)?
What is execution plan in sql?
How do I partition a table in sql?
What are instead of triggers?
what is uncommittable transactions? : Transact sql
Can instead of triggers be used to fire once for each statement on a view?
How to pipe multiline string to isql?
Is not null in sql?
Does sql*plus also have a pl/sql engine?
How many tables can a sql database have?
How to read xml file in oracle pl sql?
how to convert dates to character strings? : Sql dba
What are the types of index in sql?
What are different sql data types?
What is pl sql script?