SQL revocation indexes, tables, and databases

Source: Internet
Author: User
Tags ibm db2
SQL revocation indexes, tables, and databases

By using the DROP statement, you can easily delete indexes, tables, and databases.

SQL DROP INDEX Statement

We can use the DROP Index command to delete the index in the table.

Syntax for Microsoft Sqljet (and Microsoft Access):
DROP INDEX index_name on table_name
Syntax for MS SQL Server:
DROP INDEX Table_name.index_name
For IBM DB2 and Oracle syntax:
DROP INDEX index_name
Syntax for MySQL:
ALTER TABLE table_name DROP INDEX index_name
SQL DROP TABLE Statement

The DROP TABLE statement is used to delete tables (the structure, properties, and indexes of the table are also deleted):

DROP Table Name
SQL DROP DATABASE Statement

The DROP DATABASE statement is used to delete databases:

DROP database name
SQL TRUNCATE TABLE Statement

If we just need to get rid of the data in the table, but not delete the table itself, what should we do?

Please use the TRUNCATE Table command (delete only the data in the table):

TRUNCATE Table Name

SQL revocation indexes, tables, and databases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.