SQL Drop Index
, Drop 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 in a table.
DROP INDEX Syntax for MS Access:
DROP INDEX Syntax for MS SQL Server:
DROP INDEX Syntax for DB2/Oracle:
DROP INDEX Syntax for MySQL:
DROP TABLE Statement
The DROP TABLE statement is used to delete a table.
DROP DATABASE Statement
The DROP DATABASE statement is used to delete a database.
TRUNCATE TABLE Statement
If we only need to delete the data inside the table but not the table itself, what should we do?
Use the TRUNCATE TABLE statement: