码迷,mamicode.com
首页 > 数据库 > 详细

SQL -- delete

时间:2015-08-09 15:20:25      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

SQL – delete

SQL – delete

delete from user1 where id=99;

select * from user1;

| id | username |
+----+----------+
|  1 | user1    |
|  2 | user2    |
|  3 | user3    |
| 99 | I am 99  |

delete from user1 where id=99;

select * from user1;

| id | username |
+----+----------+
|  1 | user1    |
|  2 | user2    |
|  3 | user3    |

删除表中全部的数据

delete from user1;

delete from user1;

select * from user1;
Empty set (0.00 sec)

使用 delete 的时候最后先用 select 看下

select * from .. 的结果就是 delete from ... 执行的时候被删除的东向

清空一个表是使用 truncate table user1 等价上面的 delete from user1
删除一个表是使用 drop table tablename
删除一个数据库使用 drop database databasename

SQL -- delete

标签:

原文地址:http://www.cnblogs.com/sunznx/p/4715058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!