使用SQL Delete命令删除记录

数据库 SQL Server
SQL Server数据库中Delete命令常用来删除表中的数据,下文对Delete命令的语法作详细的说明,供您参考学习之用。

SQL Delete命令用于删除SQL数据库中的记录,下面就为您详细介绍SQL Delete命令的用法,希望可以让您对SQL Delete命令有更深的认识。

DELETE 声明
The DELETE statement is used to delete rows in a table.
DELETE 声明常用来删除表中的数据。

语法
DELETE FROM table_nameWHERE column_name = some_value

--------------------------------------------------------------------------------

Person:

LastName FirstName Address City
Nilsen Fred Kirkegt 56 Stavanger
Rasmussen Nina Stien 12 Stavanger

--------------------------------------------------------------------------------

Delete a Row
删除一条记录
"Nina Rasmussen" is going to be deleted:
"Nina Rasmussen" 的所有个人信息将被删除:

DELETE FROM Person WHERE LastName = 'Rasmussen'

结果

LastName FirstName Address City
Nilsen Fred Kirkegt 56 Stavanger

--------------------------------------------------------------------------------

Delete All Rows

删除所有记录
It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact:
可以不删除数据表且删除里面的所有记录行。这就意味着数据表构架,属性以及索引都会完整保留:

DELETE FROM table_name或DELETE * FROM table_name
 

 

 

【编辑推荐】

sql server系统表说明

Sql Server全文索引的迁移

SQL Server全文索引的用法

SQL Server删除表信息的三种方法

SQL Server系统表的应用

 

责任编辑:段燃 来源: 互联网
相关推荐

2010-09-08 10:00:34

SQL删除记录

2010-09-01 16:40:00

SQL删除触发器

2010-09-03 11:25:58

SQL删除

2010-09-01 17:19:49

SQL删除TABLE

2010-09-25 16:17:25

SQL语句

2020-11-17 09:01:09

MySQLDelete数据

2010-09-03 10:21:35

SQL删除

2010-09-14 13:30:28

sql server备

2010-09-28 15:46:22

SQL删除重复记录

2010-09-28 15:40:51

SQL删除重复记录

2010-09-03 13:21:01

SQL删除

2010-10-22 17:14:03

SQL Server删

2010-09-03 09:49:39

SQL删除

2010-07-26 17:00:11

SQL Server查

2023-09-21 10:50:23

MySQL数据库

2021-10-12 06:56:05

MYSQLDeleteDrop

2009-09-14 16:12:57

LINQ删除记录

2022-10-13 20:09:32

userdelLinux

2023-04-28 10:31:54

Linux命令图像

2010-10-22 16:40:27

SQL TRUNCAT
点赞
收藏

51CTO技术栈公众号