4D v16

DROP TABLE

Home

 
4D v16
DROP TABLE

DROP TABLE  


 

 

DROP TABLE [IF EXISTS] sql_name

The DROP TABLE command is used to remove the table named sql_name from a database. When the IF EXISTS constraint is passed, if the table to be removed does not exist in the database, the command does nothing and no error is generated.

This command not only removes the table structure, but also its data and any indexes, triggers and constraints that are associated with it. It cannot be used on a table that is referenced by a FOREIGN KEY constraint.

Note: You must make sure that when the DROP TABLE command is executed, there are not any records of the sql_name table that are loaded in memory in write mode. Otherwise, the error 1272 is generated.

Here is a simple example which removes the ACTOR_FANS table:

DROP TABLE ACTOR_FANS

This example does the same as the one above except that in this case, if the ACTOR_FANS table does not exist, no error is generated:

DROP TABLE IF EXISTS ACTOR_FANS



See also 

ALTER TABLE
CREATE TABLE

 
PROPERTIES 

Product: 4D
Theme: SQL Commands

 
HISTORY 

 
ARTICLE USAGE

4D SQL Reference ( 4D v16)