Skip to content

Commit c171040

Browse files
committed
Updated the document according to latest comments
1 parent 4ee7a76 commit c171040

2 files changed

Lines changed: 50 additions & 20 deletions

File tree

docs/sql-ref-syntax-ddl-drop-table.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ license: |
2121

2222
### Description
2323

24-
Deletes the table and removes the directory associated with this table from the file system if this
25-
is not `EXTERNAL` table. If the table is not present it throws exception.
24+
Deletes the table and removes the directory associated with this table from the file system
25+
if this is not `EXTERNAL` table. If the table is not present it throws exception.
2626

27-
In case of External table it only deletes the metadata and it will not remove the directory
27+
In case of External table it only deletes the metadata from metastore database and it will not remove the directory
2828
associated with this table.
2929

3030
### Syntax

docs/sql-ref-syntax-ddl-drop-view.md

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,63 @@ license: |
2020
---
2121

2222
### Description
23-
Removes the view, which was created by CREATE VIEW statement. DROP VIEW only involves
24-
changes in metadata in the metastore database.
23+
Drops the specified `VIEW`, which was created by `CREATE VIEW` statement. `DROP VIEW` only involves
24+
changes in metadata from the metastore database.
2525

2626
### Syntax
2727
{% highlight sql %}
28-
DROP VIEW [IF EXISTS] [dbname.]viewName
28+
DROP VIEW [IF EXISTS] [database_name.]view_name
2929
{% endhighlight %}
3030

3131
### Parameter
32+
<dl>
33+
<dt><code><em>IF EXISTS</em></code></dt>
34+
<dd>
35+
If specified, no exception is thrown when the view does not exist.
36+
</dd>
37+
<dt><code><em>database_name</em></code></dt>
38+
<dd>
39+
Database name where view is present.
40+
</dd>
41+
<dt><code><em>view_name</em></code></dt>
42+
<dd>
43+
view name to be dropped.
44+
</dd>
45+
</dl>
3246

33-
**dbname**
34-
35-
*Database* name where view present, if not provided it takes the *current Database*.
36-
37-
**viewName**
47+
### Example
48+
{% highlight sql %}
49+
-- Assumes a view name `employeeView` exist.
50+
DROP VIEW employeeView;
51+
+---------+--+
52+
| Result |
53+
+---------+--+
54+
+---------+--+
3855

39-
*View* to be dropped
56+
-- Assumes a view name `employeeView` exist in `userdb` database
57+
DROP VIEW userdb.employeeView;
58+
+---------+--+
59+
| Result |
60+
+---------+--+
61+
+---------+--+
4062

41-
**IF EXISTS**
63+
-- Assumes a view name `employeeView` does not exist.
64+
-- Throws exception
65+
DROP VIEW employeeView;
66+
Error: org.apache.spark.sql.AnalysisException: Table or view not found: employeeView;
67+
(state=,code=0)
4268

43-
If specified will not throw exception if *view* is not present.
69+
-- Assumes a view name `employeeView` does not exist,Try with IF EXISTS
70+
-- this time it will not throw exception
71+
DROP VIEW IF EXISTS employeeView;
72+
+---------+--+
73+
| Result |
74+
+---------+--+
75+
+---------+--+
4476

45-
### Example
46-
{% highlight sql %}
47-
DROP VIEW USERDB.USERVIEW
48-
DROP TABLE USERVIEW
49-
DROP VIEW IF EXISTS USERDB.USERVIEW
50-
DROP VIEW IF EXISTS USERVIEW
5177
{% endhighlight %}
5278

79+
### Related Statements
80+
- [CREATE VIEW ](sql-ref-syntax-ddl-create-view.html)
81+
- [CREATE DATABASE](sql-ref-syntax-ddl-create-database.html)
82+
- [DROP DATABASE](sql-ref-syntax-ddl-drop-database.html)

0 commit comments

Comments
 (0)