如果您才接触SQL不久,SQL的各种命令是一定需要掌握的,下面为您介绍SQL命令中的Drop删除表,供您参考,希望对您有所帮助。

如果您才接触SQL不久,SQL的各种命令是一定需要掌握的,下面为您介绍SQL命令中的Drop删除表,供您参考,希望对您有所帮助。

SQL中Drop删除表命令解析(sql删除表drop语句)  SQL 删除 第1张

Drop Index
取消索引
You can delete an existing index in a table with the DROP INDEX statement.
你可以将现有的索引通过DROP INDEX语句进行取消操作。

Syntax for Microsoft SQLJet (and Microsoft Access):
在Microsoft SQLJet (和 Microsoft Access)中的语法是这样的:

DROP INDEX index_name ON table_name

Syntax for MS SQL Server:
MS SQL Server的语法是这样:

DROP INDEX table_name.index_name

Syntax for IBM DB2 and Oracle:
IBM DB2和Oracle的语法为:

DROP INDEX index_name

Syntax for MySQL:
MySql则是这样:

ALTER TABLE table_name DROP INDEX index_name

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

Delete a Table or Database
删除一张表或是一数据库
To delete a table (the table structure, attributes, and indexes will also be deleted):
删除一张表(表中的数据结构,属性以及索引也会被删除):

DROP TABLE table_name

To delete a database:
要删除一个数据库的话可以这样写:

DROP DATABASE database_name

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

Truncate a Table
截表
What if we only want to get rid of the data inside a table, and not the table itself? Use the TRUNCATE TABLE command (deletes only the data inside the table):
当我们只想将表内的数据做完成清楚而保留其内部结构的话,可以使用TRUNCATE TABLE命令(仅仅删除表中的数据)

TRUNCATE TABLE table_name

转载请说明出处
知优网 » SQL中Drop删除表命令解析(sql删除表drop语句)

发表评论

您需要后才能发表评论