Can we rewrite subqueries into simple select statements or
with joins? Example?
Answers were Sorted based on User's Feedback
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 |
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 |
Do you know what are the steps to process a single select statement?
What is for xml in sql server?
what's the difference between a primary key and a unique key? : Sql server database administration
How To Make password Protected SQL Server 2005 Database i.e when i open SQL Server database then ask for password.
what is raid? : Sql server database administration
Explain about temporary stored procedure?
What are different types of subquery?
Whether the updations made to the views reflect the original records in the table
What are basics of policy management?
Can truncate be rolled back?
What is database black box testing?
Which feature in sql server 2008 has surprised you? You can name just one. : sql server database administration
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)