SQL DROP Statement

The DROP statement is used to delete object in SQL, with the DROP statement we can remove index, tables and even databases easily.

DROP INDEX

The indexes of the table can be dropped by the using the following command.

SYNTAX for MS Access
DROP INDEX index_name ON table_name

SYNTAX for SQL SERVER
DROP INDEX table_name.index_name

SYNTAX for Oracle
DROP INDEX index_name

SYNTAX for MySQL
ALTER TABLE table_name DROP INDEX index_name

For various DBMS the respective statement will drop the indexes from the table.

TO DROP TABLES

To drop the tables from the database the following syntax is used and it is same for all DBMS.

SYNTAX
DROP Table table_name

TRUNCATE

If we do not want to drop the complete table but only want to flush/delete the data inside it you can use the TRUNCATE statement.

SYNTAX
TRUNCATE Table table_name

TO DROP Databases

To drop the complete database we can use the following method and is same across all DBMS.

SYNTAX
DROP DATABASE database_name

Comments

Submitted byjoelandon Tue, 05/24/2011 - 11:30

hi sir,,bakit nyo inalis ung SMS w/Broadcasting ko po?... dahil ba sa walang code?....mas madami pa nga dyan na walang code eh!!!comment lang po.. thanks,
Submitted byadminon Tue, 05/24/2011 - 13:51

Please let me know the link that don't have a source code so I can also remove it. Thank you
Submitted byAnonymous (not verified)on Sun, 05/29/2011 - 01:01

please help me to my project about grocery store pos inventory using visual basic 6.0 thanks :)

Add new comment