FROM bang
[WHERE dieu
_kien]; state
Table wants to delete records from there.
WHERE dieu_kien
Option. The condition that the record must meet to be deleted.
TOP (giatri_dau)
This command will delete the first row in the result set based on giatri_dau. For example, TOP (10) will delete the top 10 that meet the criteria.
PERCENT
Option. If specified, the first rows are based on the percentage of giatri_dau of the result set. For example, TOP (10) PERCENT will insert 10% of the first value in the result set.
Note
There is no need to list all fields in the DELETE statement because it will delete all rows in the table.
For example - use the keyword TOP
DELETE TOP(10)
FROM nhanvien
WHERE ho
= 'Anderson';
In this example, the DELETE TOP command will delete the first 10 records in the table with the employee family, Anderson. If there are other records that also have the family name of Anderson, they will not be deleted.
For example - use the keyword TOP PERCENT
DELETE TOP (25) PERCENT
FROM nhanvien
WHERE ten = 'Sarah';
In this example, 25% of the DELETE TOP response's delete records will be deleted. The remaining 75% will not be deleted.
Previous article: SELECT INTO command in SQL Server
The following article: UNION operator in SQL Server