what is the difference between the query and corelated
query

Answer Posted / lova raju allumalla

when performing joins on two or more tables, we normally
write a query making use relational operators such as =
etc. which means each and every row of every table is
compared with each other,which is a unwanted situation when
looked in the perspective performance issue. where as
making use of corelated query one can minimise the tedoius
checks as described above. consider the example below with
a normal join
select * from emp e,dept d where e.deptno=d.deptno;

now the above same can be performed by using the co related
query
select * from emp where deptno in (select deptno from dept);

u can now make up the difference, in the first approach in
emp table, each row deptno value compared for each row
deptno value of dept table.where as in second approach the
(select deptno from dept) is executed only once for all
checks of the outer query select * from emp where deptno

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data profiling in sql?

520


what is text? : Sql dba

564


What is a sql statement?

535


What are the different types of a subquery?

523


How can you create an empty table from an existing table?

596






Explain mutating table error.

649


What are sql built in functions?

510


what is cross join? : Sql dba

576


Lookups are a key component in sql server integration services (ssis). Explain its purpose?

539


What are literals in sql server?

539


discuss about myisam key cache. : Sql dba

565


what is the difference between primary key and unique key? : Sql dba

532


Can we use loop in sql?

537


What is the difference between the repeatable read and serializable isolation levels? : Transact sql

537


Is pl sql a scripting language?

592