SQL Getting Sta...login
SQL Getting Started Tutorial Manual
author:php.cn  update time:2022-04-12 14:15:40

SQL DROP


SQL DROP INDEX, UNDRAW TABLE AND DROP DATABASE


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


DROP INDEX statement

The DROP INDEX statement is used to delete an index from a table.

DROP INDEX syntax for MS Access:

DROP INDEX index_name ON table_name
DROP INDEX syntax for MS SQL Server:

DROP INDEX table_name.index_name
DROP INDEX syntax for DB2/Oracle:

DROP INDEX index_name
DROP INDEX syntax for MySQL:

ALTER TABLE table_name DROP INDEX index_name


DROP TABLE statement

DROP The TABLE statement is used to delete a table.

DROP TABLE table_name


DROP DATABASE statement

The DROP DATABASE statement is used to delete a database.

DROP DATABASE database_name

##TRUNCATE TABLE statement

If we only need to delete the data in the table, but not delete it table itself, so what do we do?

Please use the TRUNCATE TABLE statement:

TRUNCATE TABLE table_name