Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

DROP TABLE

Description

You can drop an existing table by the DROP statement. Multiple tables can be dropped by a single DROP statement. All rows of table are also dropped. If you use it together with the IF EXISTS statement, you can prevent errors from occurring and specify multiple tables in one statement.

Syntax

DROP [ TABLE | CLASS ] [ IF EXISTS ] <table_specification_comma_list>

 

<table_specification_comma_list> ::=

<single_table_spec> | ( <table_specification_comma_list> )

 

<single_table_spec> ::=

|[ ONLY ] table_name

| ALL table_name [ ( EXCEPT table_name, ... ) ]

  • table_name: Specifies the name of the table to be dropped. You can delete multiple tables simultaneously by separating them with commas.
  • If a super class name is specified after the ONLY keyword, only the super class, not the sub classes inheriting from it, is deleted. If a super class name is specified after the ALL keyword, the super classes as well as the sub classes inheriting from it are all deleted. You can specify the list of sub classes not to be deleted after the EXCEPT keyword.
  • If sub classes that inherit from the super class specified after the ALL keyword are specified after the EXCEPT keyword, they are not deleted.
  • Specifies the list of subclasses which are not to be deleted after the EXCEPT keyword.
Example

DROP TABLE history ;

CREATE TABLE t (i INT);

 

-- DROP TABLE IF EXISTS

DROP TABLE IF EXISTS history, t;

2 command(s) successfully processed.

 

SELECT * FROM t;

In line 1, column 10, ERROR: Unknown class "t".