sjwiesman commented on a change in pull request #10669: 
[FLINK-15192][docs][table] Restructure "SQL" pages for better readability
URL: https://github.com/apache/flink/pull/10669#discussion_r361867177
 
 

 ##########
 File path: docs/dev/table/sql/drop.md
 ##########
 @@ -0,0 +1,155 @@
+---
+title: "DROP Statements"
+nav-parent_id: sql
+nav-pos: 3
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+* This will be replaced by the TOC
+{:toc}
+
+DROP statements are used to remove a registered table/view/function from 
current or specified [Catalog]({{ site.baseurl }}/dev/table/catalogs.html).
+
+Flink SQL supports the following DROP statements for now:
+
+- DROP TABLE
+- DROP VIEW
+- DROP FUNCTION
+- DROP DATABASE
+
+## Run a DROP statement
+
+DROP statements can be executed with the `sqlUpdate()` method of the 
`TableEnvironment`, or executed in [SQL CLI]({{ site.baseurl 
}}/dev/table/sqlClient.html). The `sqlUpdate()` method returns nothing for a 
successful DROP operation, otherwise will throw an exception.
+
+The following examples show how to run a DROP statement in `TableEnvironment`.
+
+<div class="codetabs" markdown="1">
+<div data-lang="java" markdown="1">
+{% highlight java %}
+EnvironmentSettings settings = EnvironmentSettings.newInstance()...
+TableEnvironment tableEnv = TableEnvironment.create(settings);
+
+// register a table named "Orders"
+tableEnv.sqlUpdate("CREATE TABLE Orders (`user` BIGINT, product STRING, amount 
INT) WITH (...)");
+
+// a string array: ["Orders"]
+String[] tables = tableEnv.listTable();
+
+// drop "Orders" table from catalog
+tableEnv.sqlUpdate("DROP TABLE Orders");
+
+// an empty string array
+String[] tables = tableEnv.listTable();
+{% endhighlight %}
+</div>
+
+<div data-lang="scala" markdown="1">
+{% highlight scala %}
+val settings = EnvironmentSettings.newInstance()...
+val tableEnv = TableEnvironment.create(settings)
+
+// register a table named "Orders"
+tableEnv.sqlUpdate("CREATE TABLE Orders (`user` BIGINT, product STRING, amount 
INT) WITH (...)");
+
+// a string array: ["Orders"]
+val tables = tableEnv.listTable()
+
+// drop "Orders" table from catalog
+tableEnv.sqlUpdate("DROP TABLE Orders")
+
+// an empty string array
+val tables = tableEnv.listTable()
+{% endhighlight %}
+</div>
+
+<div data-lang="python" markdown="1">
+{% highlight python %}
+settings = EnvironmentSettings.newInstance()...
+table_env = TableEnvironment.create(settings)
+
+# a string array: ["Orders"]
+tables = tableEnv.listTable()
+
+# drop "Orders" table from catalog
+tableEnv.sqlUpdate("DROP TABLE Orders")
+
+# an empty string array
+tables = tableEnv.listTable()
+{% endhighlight %}
+</div>
+</div>
+
+The following examples show how to run a DROP statement in SQL CLI.
+
+{% highlight sql %}
+Flink SQL> CREATE TABLE Orders (`user` BIGINT, product STRING, amount INT) 
WITH (...);
+[INFO] Table has been created.
+
+Flink SQL> SHOW TABLES;
+Orders
+
+Flink SQL> DROP TABLE Orders;
+[INFO] Table has been removed.
+
+Flink SQL> SHOW TABLES;
+[INFO] Result was empty.
+{% endhighlight %}
+
+
+## DROP TABLE
+
+{% highlight sql %}
+DROP TABLE [IF EXISTS] [catalog_name.][db_name.]table_name
+{% endhighlight %}
+
+Drop a table with the given table name. If the table to drop does not exist, 
an exception is thrown.
+
+**IF EXISTS**
+
+If the table does not exist, nothing happens.
+
+
+## DROP VIEW
+
+*TODO: should add descriptions.*
+
+## DROP FUNCTION
+
+*TODO: should add descriptions.*
 
 Review comment:
   
   Please either fill these in or remove the sections entirely and re-add them 
in a follow up PR.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to