You can delete an existing index in a table with the DROP INDEX statement.
Syntax for Microsoft SQLJet (and Microsoft Access):
DROP INDEX indexName ON tableName; |
Syntax for MS SQL Server:
DROP INDEX tableName.indexName; |
Syntax for IBM DB2 and Oracle:
DROP INDEX indexName; |
Syntax for MySQL:
ALTER TABLE tableName DROP INDEX indexName; |
To delete a table (the table structure, attributes, and indexes will also be deleted):
DROP TABLE tableName; |
To delete a database:
DROP DATABASE databaseName; |
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 tableName; |
To test your SQL skills click here.