MS SQL Server Concepts and Programming Question:
Download Questions PDF

What Is a Subquery in a SELECT Query Statement in MS SQL Server?

Answer:

A subquery is a SELECT statement used as part of the selection criteria of the main SELECT statement. The subquery specified in the WHERE clause will be evaluated repeated on each row of the selection base table. The output of the subquery will be used in the final evaluation of the criteria. Usually, subqueries are used in the following Boolean operations:

* "expression IN (subquery)" - True if the expression matches one of the returned values from the subquery.
* "expression NOT IN (subquery)" - True if the expression does not match any of the returned values from the subquery.
* "EXISTS (subquery)" - True if the subquery returns one or more rows.
* "NOT EXISTS (subquery)" - True if the subquery returns no rows.


Download MS SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
How To Name Query Output Columns in MS SQL Server?How To Use Subqueries with the IN Operators in MS SQL Server?