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 abstraction in sql?
how to check myisam tables for errors? : Sql dba
Is it possible to pass parameters to triggers?
Show code of a cursor for loop.
What is embedded sql what are its advantages?
Which is faster joins or subqueries?
What are sql indexes?
what is subquery? : Sql dba
what is sub-query? : Transact sql
describe transaction-safe table types in mysql : sql dba
What is difference between stored function and application function?
What are triggers and its types?
What is date functions?
Can we enter data in a table in design view?
How do you create an update query?