Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

Where Clause

Where Clause:

Where clause specifies the search condition for the rows returned by the query.

Syntax:

[WHERE  <search_condition>] 

Examples:

Where clause with Select statement:
SELECT * FROM [User] WHERE UserType=1 and ManagerId>0


Where clause with Update Statement:
UPDATE [User] SET ManagerId=2 ,UpdatedDate=GETDATE() WHERE LoginName='Sharad'


Now execute query SELECT * FROM [User]
Query returns updated record with manger id 2


 

Where clause with Delete statement:
DELETE FROM [USER] WHERE LoginName='Sanskruti'

Now execute query “SELECT * FROM [User]” to check result

Query returns only five rows



 

Invalid entry,please enter valid data.

Loading