Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs][YSQL][#2355] DROP TABLE multiple tables (#2355) #2382

Merged
merged 1 commit into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/content/latest/api/ysql/commands/ddl_drop_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ showAsideToc: true

## Synopsis

Use the `DROP TABLE` statement to remove a table and all of its data from the database.
Use the `DROP TABLE` statement to remove one or more tables (with all of their data) from the database.

## Syntax

Expand Down Expand Up @@ -47,9 +47,13 @@ Use the `DROP TABLE` statement to remove a table and all of its data from the da

### *drop_table*

#### *if_exists*

Under normal operation, an error is raised if the table does not exist. Adding `IF EXISTS` will quietly ignore any non-existent tables specified.

#### *table_name*

Specify the name of the table to be dropped. If the table does not exist, an error is raised. Objects associated with the table, such as prepared statements, will be eventually invalidated after the `DROP TABLE` statement is completed.
Specify the name of the table to be dropped. Objects associated with the table, such as prepared statements, will be eventually invalidated after the `DROP TABLE` statement is completed.

## See also

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### drop_table

<svg class="rrdiagram" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="408" height="50" viewbox="0 0 408 50"><path class="connector" d="M0 22h15m53 0h10m58 0h30m32 0h10m64 0h20m-141 0q5 0 5 5v8q0 5 5 5h116q5 0 5-5v-8q0-5 5-5m5 0h10m91 0h15"/><polygon points="0,29 5,22 0,15" style="fill:black;stroke-width:0"/><rect class="literal" x="15" y="5" width="53" height="25" rx="7"/><text class="text" x="25" y="22">DROP</text><rect class="literal" x="78" y="5" width="58" height="25" rx="7"/><text class="text" x="88" y="22">TABLE</text><rect class="literal" x="166" y="5" width="32" height="25" rx="7"/><text class="text" x="176" y="22">IF</text><rect class="literal" x="208" y="5" width="64" height="25" rx="7"/><text class="text" x="218" y="22">EXISTS</text><a xlink:href="../../syntax_resources/grammar_diagrams#table-name"><rect class="rule" x="302" y="5" width="91" height="25"/><text class="text" x="312" y="22">table_name</text></a><polygon points="404,29 408,29 408,15 404,15" style="fill:black;stroke-width:0"/></svg>
<svg class="rrdiagram" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="448" height="80" viewbox="0 0 448 80"><path class="connector" d="M0 52h15m53 0h10m58 0h30m32 0h10m64 0h20m-141 0q5 0 5 5v8q0 5 5 5h116q5 0 5-5v-8q0-5 5-5m5 0h30m-5 0q-5 0-5-5v-20q0-5 5-5h38m24 0h39q5 0 5 5v20q0 5-5 5m-5 0h35"/><polygon points="0,59 5,52 0,45" style="fill:black;stroke-width:0"/><rect class="literal" x="15" y="35" width="53" height="25" rx="7"/><text class="text" x="25" y="52">DROP</text><rect class="literal" x="78" y="35" width="58" height="25" rx="7"/><text class="text" x="88" y="52">TABLE</text><rect class="literal" x="166" y="35" width="32" height="25" rx="7"/><text class="text" x="176" y="52">IF</text><rect class="literal" x="208" y="35" width="64" height="25" rx="7"/><text class="text" x="218" y="52">EXISTS</text><rect class="literal" x="355" y="5" width="24" height="25" rx="7"/><text class="text" x="365" y="22">,</text><a xlink:href="../../syntax_resources/grammar_diagrams#table-name"><rect class="rule" x="322" y="35" width="91" height="25"/><text class="text" x="332" y="52">table_name</text></a><polygon points="444,59 448,59 448,45 444,45" style="fill:black;stroke-width:0"/></svg>

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```
drop_table ::= DROP TABLE [ IF EXISTS ] table_name
drop_table ::= DROP TABLE [ IF EXISTS ] table_name [ , ... ]
```
Original file line number Diff line number Diff line change
Expand Up @@ -1113,9 +1113,9 @@ drop_sequence ::= DROP SEQUENCE [ IF EXISTS ] sequence_name

### drop_table
```
drop_table ::= DROP TABLE [ IF EXISTS ] table_name
drop_table ::= DROP TABLE [ IF EXISTS ] table_name [ , ... ]
```
<svg class="rrdiagram" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="408" height="50" viewbox="0 0 408 50"><path class="connector" d="M0 22h15m53 0h10m58 0h30m32 0h10m64 0h20m-141 0q5 0 5 5v8q0 5 5 5h116q5 0 5-5v-8q0-5 5-5m5 0h10m91 0h15"/><polygon points="0,29 5,22 0,15" style="fill:black;stroke-width:0"/><rect class="literal" x="15" y="5" width="53" height="25" rx="7"/><text class="text" x="25" y="22">DROP</text><rect class="literal" x="78" y="5" width="58" height="25" rx="7"/><text class="text" x="88" y="22">TABLE</text><rect class="literal" x="166" y="5" width="32" height="25" rx="7"/><text class="text" x="176" y="22">IF</text><rect class="literal" x="208" y="5" width="64" height="25" rx="7"/><text class="text" x="218" y="22">EXISTS</text><a xlink:href="../grammar_diagrams#table-name"><rect class="rule" x="302" y="5" width="91" height="25"/><text class="text" x="312" y="22">table_name</text></a><polygon points="404,29 408,29 408,15 404,15" style="fill:black;stroke-width:0"/></svg>
<svg class="rrdiagram" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="448" height="80" viewbox="0 0 448 80"><path class="connector" d="M0 52h15m53 0h10m58 0h30m32 0h10m64 0h20m-141 0q5 0 5 5v8q0 5 5 5h116q5 0 5-5v-8q0-5 5-5m5 0h30m-5 0q-5 0-5-5v-20q0-5 5-5h38m24 0h39q5 0 5 5v20q0 5-5 5m-5 0h35"/><polygon points="0,59 5,52 0,45" style="fill:black;stroke-width:0"/><rect class="literal" x="15" y="35" width="53" height="25" rx="7"/><text class="text" x="25" y="52">DROP</text><rect class="literal" x="78" y="35" width="58" height="25" rx="7"/><text class="text" x="88" y="52">TABLE</text><rect class="literal" x="166" y="35" width="32" height="25" rx="7"/><text class="text" x="176" y="52">IF</text><rect class="literal" x="208" y="35" width="64" height="25" rx="7"/><text class="text" x="218" y="52">EXISTS</text><rect class="literal" x="355" y="5" width="24" height="25" rx="7"/><text class="text" x="365" y="22">,</text><a xlink:href="../grammar_diagrams#table-name"><rect class="rule" x="322" y="35" width="91" height="25"/><text class="text" x="332" y="52">table_name</text></a><polygon points="444,59 448,59 448,45 444,45" style="fill:black;stroke-width:0"/></svg>

### drop_type
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ drop_rule = 'DROP' 'RULE' [ 'IF' 'EXISTS' ] rule_name 'ON' table_name [ 'CASCADE
drop_sequence ::= 'DROP' 'SEQUENCE' [ 'IF' 'EXISTS' ] sequence_name [ 'CASCADE' | 'RESTRICT' ] ;

(* 'DROP' 'TABLE' *)
drop_table ::= 'DROP' 'TABLE' [ 'IF' 'EXISTS' ] table_name ;
drop_table ::= 'DROP' 'TABLE' [ 'IF' 'EXISTS' ] table_name { ',' table_name} ;

(* 'DROP' 'TYPE' *)
drop_type ::= 'DROP' 'TYPE' [ 'IF' 'EXISTS' ] type_name { ',' type_name }
Expand Down