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 ? | 15 Yes | 3 No |
Post New Answer View All Answers
What are views in sql?
How do you get column names only for a table (sql server)?
How to get list of all tables from a database?
What are sql triggers used for?
Which data type is a composite type?
Do ddl statements need commit?
What if we write return in procedure?
how would you get the current date in mysql? : Sql dba
What is a variable in sql?
How do I view tables in mysql?
Why left join is used in sql?
how do you know if your mysql server is alive? : Sql dba
what are the types of subquery? : Sql dba
What does select top 1 do in sql?
How can we debug in PL/SQL?