Search:     Advanced search
Browse by category:
C/C++   |   Java   |   Oracle/Database   |   SAP   |   ASP .NET   |   Mainframe-DB2   |   Freshers

What is sub-query? Explain properties of sub-query?

Add comment
Views: 59
Votes: 0
Comments: 0
Sub-queries are often referred to as sub-selects, as they allow a SELECT statement to be executed arbitrarily within the body of another SQL statement. A sub-query is executed by enclosing it in a set of parentheses. Sub-queries are generally used to return a single row as an atomic value, though they may be used to compare values against multiple rows with the IN keyword.

A subquery is a SELECT statement that is nested within another T-SQL statement. A subquery SELECT statement if executed independently of the T-SQL statement, in which it is nested, will return a resultset. Meaning a subquery SELECT statement can standalone and is not depended on the statement in which it is nested. A subquery SELECT statement can return any number of values, and can be found in, the column list of a SELECT statement, a FROM, GROUP BY, HAVING, and/or ORDER BY clauses of a T-SQL statement. A Subquery can also be used as a parameter to a function call. Basically a subquery can be used anywhere an expression can be used.
Others in this Category
document What is Difference between Function and Stored Procedure?
document What are primary keys and foreign keys?
document Q: What is pseudo columns ? Name them?
document What is RAISEERROR?
document What is PRIMARY KEY?
document How can we rewrite sub-queries into simple select statements or with joins?
document What are the properties of the Relational tables?
document Q: Explain UNION,MINUS,UNION ALL, INTERSECT ?
document What are different normalization forms?
document How to copy the tables, schema and views from one SQL Server to another?
» More articles



RSS