Properties and Different Types of Sub-Queries in SQL Server

Background

Many times in interview ,interviewer asked the question what are properties and different Types of Sub-Queries in sql server,at that time freshers or any experienced candidate may be confuse how to give answer, so by considering above requirement i have decided to write this blog to help job seeker and who wants to know  what are properties and different Types of Sub-Queries in sql server , so let us see.

Properties of Sub-Query
  1. A sub-query must be enclosed in the parenthesis.
  2. A sub-query must be put in the right hand of the comparison operator, and
  3. A sub-query cannot contain an ORDER-BY clause.
  4. A query can contain more than one sub-query.
Types of Sub-Query
  1. Single-row sub-query, where the sub-query returns only one row.
  2. Multiple-row sub-query, where the sub-query returns multiple rows,. and
  3. Multiple column sub-query, where the sub-query returns multiple columns.
Summary

I hope this small blog is helpful for all job seeker and other readers, if you have any suggestion then please contact me.