what is the difference between the query and corelated
query
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
What do you mean by dbms? What are its different types?
if we give update table_name set column_name= default. what will happen? its given in pl sql block.what will hapen?
write a query to find out the no. of employees whose age is less than 25 and max of salary for the employees belonging to a particular department is less than 20000
Difference between truncate, delete and drop commands?
Explain the structure of pl/sql in brief.
what are the methods using performance tunning in sql and pl/sql
what are the types of join and explain each? : Sql dba
What is the difference between DELETE and TRUNCATE?
15 Answers Johns Hopkins University, Tech Mahindra,
what is meant by forward declaration in functions?
What is referential integrity ?
What is the use of stored procedures?
take one table is t1 and in that column name is f1 f1 column values are 200 5000 3000 7000 300 600 100 400 800 400 i want display the values asc and desc in a single output. sample output is f1.a 100 200 300 400 500 600 etc...... and f1.d is 5000 4000 3000 2000 1000 etc...