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
how to create a test table in your mysql server? : Sql dba
how to convert character strings to numeric values? : Sql dba
Explain the difference between 'between' & 'and' operators in sql
what is table? : Sql dba
Why do we need a foreign key?
How to fetch values from testtable1 that are not in testtable2 without using not keyword?
How does cross join work?
Can a foreign key be null?
Is sql similar to python?
What is difference between db2 and sql?
What does trigger mean in slang?
What is pivot in sql?
What is the benefit of foreign key?
Is t sql a programming language?
Is a foreign key always unique?