WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

SQL DROP INDEX, DROP TABLE, and DROP DATABASE



Drop statements make it easy to drop indexes, tables, and databases.


DROP INDEX statement

DROP INDEX statement is used to drop 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 TABLE statement is used to drop a table.

DROP TABLE table_name


DROP DATABASE statement

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 the table itself, what should we do?

Please use the TRUNCATE TABLE statement:

TRUNCATE TABLE table_name