Can we rewrite subqueries into simple select statements or
with joins? Example?

Answers were Sorted based on User's Feedback



Can we rewrite subqueries into simple select statements or with joins? Example?..

Answer / divya kalra

Subqueries can often be re-written to use a standard outer
join, resulting in faster performance. As we may know, an
outer join uses the plus sign (+) operator to tell the
database to return all non-matching rows with NULL values.
Hence we combine the outer join with a NULL test in the
WHERE clause to reproduce the result set without using a
sub-query.

Is This Answer Correct ?    4 Yes 1 No

Can we rewrite subqueries into simple select statements or with joins? Example?..

Answer / syed sajjad

Yes we can write using Common Table Expression (CTE). A Common Table Expression (CTE) is an expression that can be thought of as a temporary result set which is defined within the execution of a single SQL statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What does it mean to manipulate data?

0 Answers  


Differentiate between a primary key and a unique key.

0 Answers  


Why use update_statistics command in sql server?

0 Answers  


What is the process of normalising?

0 Answers  


what are the disadvantages of cursors? : Sql server database administration

0 Answers  






plz send every query in sql server2000

1 Answers   Infosys,


What is filtered index?

0 Answers  


What is the difference between online clustering and Offline clustering?

0 Answers   IBM,


What is stored in the mssqlsystemresource database? : sql server database administration

0 Answers  


How to find the date and time of last updated table?

3 Answers  


What are the different types of backup avaible in SQL SErver

6 Answers   Emphasis, IBM,


Are connections to sql server encrypted?

0 Answers  


Categories