DROP Statement SQL

The DROP Statement is used to completely remove databases, tables, columns, and indexes. Great care should be used when employing this statement. All the data within the structural unit DROPped will be pretty much irretrievably deleted.

The syntax for DROP is fairly simple. Any one of the following will do what it says:

DROP COLUMN column

DROP TABLE table

DROP DATABASE database

To take out an index, which is used to search within a column is a little more tricky. It is used in conjunction with the ALTER TABLE Statement:

ALTER TABLE table DROP INDEX index

It should be noted that DROP is a structural verb, meaning that it will permanently change the structure of the database or at least a part of it. Other means should be used to get rid of data. To take out all of the data in a table try TRUNCATE.

TRUNCATE TABLE table_name

< DISTINCT SQL | FOREIGN KEY Constraint SQL >


Send notes in disappearing ink!

Interesting Pages