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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what is difference between view and materialized view?

530


What is isnull() operator?

582


Where is trigger in sql server?

547


How do you delete duplicate records in sql server?

517


What are blobs, tables, and Queues? Is SQL is the standard way to query blobs, tables, and queues?

117






What is the purpose of a table?

536


What are the types of ssrs?

108


List down some advantages of sql stored procedure?

570


What is the maximum rows in sql server table?

522


How to verify a user name with sqlcmd tool?

591


Define constraints and give an example of their use?

570


What is awe?

577


What is role playing dimension with two examples? : sql server analysis services, ssas

601


Explain the difference between function and stored procedure?

528


Explain about local stored procedure?

512