Use SQL statements to delete a specified record
Delete a specified record using the delete statement in an SQL statement.
The delete statement syntax is as follows:
Delete from <Table Name> [where <search_condition>]
Parameters:
Table Name: name of the data table.
Where: Specifies the condition used to limit the number of rows to be deleted. If the WHERE clause is not provided, delete deletes all rows in the table.
Search_condition: specifies the conditions for deleting rows.
Example:
Use the delete statement to delete the student information whose name is "Wang X" in the "student" table.
Use student
Delete from student where name = 'wang x'
Go
For some data tables without a primary key or index, there are a large number of duplicate or NULL data records in the data table.
If you use the WHERE clause to limit the deletion conditions, some useful information in the data table will also be deleted. SQL Server provides the syntax for deleting null records in the delete statement.