SQL截断,删除,删除建议 [英] SQL Truncate, Delete, Drop advise

查看:147
本文介绍了SQL截断,删除,删除建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQL数据库中有一个表,我想从中删除数据?我想保留列。

I have a table in a SQL db that I want to remove the data from? I want to keep the columns though.

例如。我的表有3列,Name,Age,Date。我不想删除这些,我只是想删除数据。

e.g. my table has 3 columns, Name, Age, Date. I don't want to remove these, i just want to remove the data.

应该截断,删除还是删除?

Should I should Truncate, Delete or Drop?

推荐答案

不要删除 - 它将删除数据和定义。

如果删除 - 数据已删除并自动递增值从最后一个值继续。

如果你截断 - 那么它就像你刚刚创建的表。没有数据和所有计数器重置

Don't drop - it will delete the data and the definition.
If you delete - the data is gone and auto-increment values go on from the last value.
If you truncate - then it is like you just did create the table. No data and all counters resetted

这篇关于SQL截断,删除,删除建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆