Delete is the data manipulation Language statement which can be used to Remove the existing Record from a Table or a view.
We will see the syntax of the Delete statement :
Syntax :
DELETE [ TOP ( expression ) [PERCENT ] ] [ FROM ]{<object>} [ WHERE { <search_condition> } ]
<object> ::= { [ server_name .database_name .schema_name . |database_name.schema_name ]. |schema_name . ] table_or_view_name}
- TOP ( expression ) [ PERCENT ]
-
Specifies the number or percent of rows that will be updated.
- server_name
-
Is the name of the linked server on which the table or view is located.
- database_name
-
Is the name of the database.
- schema_name
-
Is the name of the schema to which the table or view belongs.
- table_or view_name
-
Is the name of the table or view from which the rows are to be updated.
- WHERE
- Specifies the conditions used to limit the number of rows that are deleted. If a WHERE clause is not supplied, DELETE removes all the rows from the table.
- <search_condition>
- Specifies the restricting conditions for the rows to be deleted. There is no limit to the number of predicates that can be included in a search condition.
Example :
Let us see the example for Deleting an Employee from the Employee table where the Employee Id is ‘Emp007’
Delete Employee
Where
EmpId = 'Emp007'
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.