what is the difference between the query and corelated
query

Answers were Sorted based on User's Feedback



what is the difference between the query and corelated query..

Answer / guru

Correlated Query: If a sub query has a Reference with the
value or values of Main Query , It is called as Correlated
Sub query.

Thanks

Is This Answer Correct ?    11 Yes 2 No

what is the difference between the query and corelated query..

Answer / saurabh

When 1st main query is executed then the result of the main
query is used in teh where clause of subquery then this
type of subquery is called as co-related sub query.

Is This Answer Correct ?    7 Yes 0 No

what is the difference between the query and corelated query..

Answer / aravinda

query: query is single time validation of conditions for
entire result once result is fetched there no further
validation of records.

corelated sub query : each record is validated with inner
query aftr fetch.

1) outer query will execute first and pass a value to inner
query.
2) based on outer query value inner query will execute.
3) based on inner query value the outer query record will be
validated.

inner query will execute for every record of outer query( if
outer query has 10 records inner query will execute 10 times)

Is This Answer Correct ?    6 Yes 0 No

what is the difference between the query and corelated query..

Answer / manish

select * from emp; --->> query

select * from emp where sal=(select max(sal) from emp);
--> here a sub query is also there

select * from emp outer where sal= ( select avg(sal) from
emp e where dept.e=dept.outer) --> corelated query

Is This Answer Correct ?    9 Yes 7 No

what is the difference between the query and corelated query..

Answer / chintu

A query is nothing but if we want to evaluate one thing we
will write query. like
select * from emp; --->> query

A Query is evaluated once for each and every row from the
parent statement is called corellated Query.
like
select * from emp outer where sal= ( select avg(sal) from
emp e where dept.e=dept.outer) --> corelated query

Is This Answer Correct ?    2 Yes 0 No

what is the difference between the query and corelated query..

Answer / 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

what is the difference between the query and corelated query..

Answer / amar_kondla

select * from emp----- is a query;


and

co-related query is sub one of sub qury( sub qury
means--whose returning values are filtering the condition
of the main query)
ex; SELECT * FROM EMP E
WHERE E.SAL>( SELECT AVG(SAL) FROM EMP F
WHERE E.DEPTNO= F.DEPTNO);


SO HERE WE R FINDING THE EMPLOYEE WHO HAS GETTING MORE THAN
AVG(SAL) OF RESPECTING DEPTNO.

AND CO RELATED SUB QUERY ALWAYS USE ALIAS NAME FOR TABLE, IT
SIMILAR LIKE JAIN(SELF JOIN)

Is This Answer Correct ?    3 Yes 4 No

what is the difference between the query and corelated query..

Answer / guruswamy

corelated query is refered by each an every value by
subquery.
normal query is referd by subquery one bulk amount to get a
main query

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

Can we insert in sql function?

0 Answers  


what is sql and plsql

6 Answers  


What is difference between group by and partition by?

0 Answers  


a table has 2 classifications 1)liabilities 2)earnings this liabitity has 2 elements with 2 input values and the earnings have 2 elements with 2 input values i wrote a query so that my input is liability savings amount1 amount2 xxxx null xxxxxx 0 xxx1 null xxxxx1 0 null yyyy 0 yyyy null yyy1 0 yyy1 my problem is --when i developed a report(d2k) with this data my o/p is liabilities,amount1,savings,amount2 xxxx xxxxxx xxx1 xxxxx1 yyyy yyyy yyy1 yyy1 how could i move this savings,savings values 2 palces up. can any body provide me witha better solution

0 Answers   TCS,


What is pl sql block in dbms?

0 Answers  






What are functions in sql?

0 Answers  


How does pl sql work?

0 Answers  


Why do we need databases?

0 Answers  


What are its different types of dbms?

0 Answers  


what is cursor. write example of it. What are the attributes of cursor.

0 Answers  


what is a scheduled jobs or what is a scheduled tasks? : Sql dba

0 Answers  


What is cursor and its types?

0 Answers  


Categories