SQL DELETE

2015-09-07 0 669

SQL DELETE 语句


DELETE 语句用于删除表中的记录。


SQL DELETE 语句

DELETE 语句用于删除表中的行。

SQL DELETE 语法

DELETE FROM table_name
WHERE some_column=some_value;

lamp 请注意 SQL DELETE 语句中的 WHERE 子句!
WHERE 子句规定哪条记录或者哪些记录需要删除。如果您省略了 WHERE 子句,所有的记录都将被删除!


演示数据库

在本教程中,我们将使用众所周知的 Northwind 样本数据库。

下面是选自 \”Customers\” 表的数据:

CustomerID CustomerName ContactName Address City PostalCode Country
1

Alfreds Futterkiste Maria Anders Obere Str. 57 Berlin 12209 Germany
2 Ana Trujillo Emparedados y helados Ana Trujillo Avda. de la Constitución 2222 México D.F. 05021 Mexico
3 Antonio Moreno Taquería Antonio Moreno Mataderos 2312 México D.F. 05023 Mexico
4

Around the Horn Thomas Hardy 120 Hanover Sq. London WA1 1DP UK
5 Berglunds snabbköp Christina Berglund Berguvsvägen 8 Luleå S-958 22 Sweden


SQL DELETE 实例

假设我们要从 \”Customers\” 表中删除客户 \”Alfreds Futterkiste\”。

我们使用下面的 SQL 语句:

实例

DELETE FROM Customers
WHERE CustomerName=\’Alfreds Futterkiste\’ AND ContactName=\’Maria Anders\’;

遇见资源网 SQL归档 SQL DELETE http://www.ox520.com/4464.html

上一篇:

已经没有上一篇了!

下一篇:

已经没有下一篇了!

常见问题

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务