Answer Posted / asnani_satish@yahoo.com
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,sum(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". The query is behaving as a temporary table.
| Is This Answer Correct ? | 16 Yes | 3 No |
Post New Answer View All Answers
Which join is like inner join?
What is the difference between mdf and ndf files?
Are views faster than queries?
How to rename a table?
What are the types of queries in sql?
Which are the different types of indexes in sql?
What are the parts of a sql statement?
What is sql partition function?
How to select unique records from a table?
what is sp_pkeys? : Transact sql
How to avoid using cursors? What to use instead of cursor and in what cases to do so?
What is the difference between clustered and non-clustered index in sql?
Write an sql query to select all records from the table?
What is interval partition?
How do I view a sql trace file?