Tuesday 18 September 2012

EXISTS Function From SQL

This following Query Explains, How to use Exists in SQL Query.

Have a look at the sample given below
USE database name
GO
SELECT column1,column2.... FROM table name
WHERE exists
(SELECT * FROM table name WHERE (condition))
GO
When a subquery is introduced with the keyword EXISTS, it functions as an existence test. The WHERE clause of the outer query tests for the existence of rows returned by the subquery. The subquery does not actually produce any data; it returns a value of TRUE or FALSE.

No comments:

Post a Comment