Skip to content

Commit b83304f

Browse files
sandeep-kattagatorsmile
authored andcommitted
[SPARK-28796][DOC] Document DROP DATABASE statement in SQL Reference
### What changes were proposed in this pull request? Document DROP DATABASE statement in SQL Reference ### Why are the changes needed? Currently from spark there is no complete sql guide is present, so it is better to document all the sql commands, this jira is sub part of this task. ### Does this PR introduce any user-facing change? Yes, Before there was no documentation about drop database syntax After Fix ![image](https://user-images.githubusercontent.com/35216143/64787097-977a7200-d58d-11e9-911c-d2ff6f3ccff5.png) ![image](https://user-images.githubusercontent.com/35216143/64787122-a6612480-d58d-11e9-978c-9455baff007f.png) ### How was this patch tested? tested with jenkyll build Closes #25554 from sandeep-katta/dropDbDoc. Authored-by: sandeep katta <sandeep.katta2007@gmail.com> Signed-off-by: Xiao Li <gatorsmile@gmail.com>
1 parent ee63031 commit b83304f

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

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

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,62 @@ license: |
1919
limitations under the License.
2020
---
2121

22-
**This page is under construction**
22+
### Description
23+
24+
Drop a database and delete the directory associated with the database from the file system. An
25+
exception will be thrown if the database does not exist in the system.
26+
27+
### Syntax
28+
29+
{% highlight sql %}
30+
DROP (DATABASE|SCHEMA) [IF EXISTS] dbname [RESTRICT|CASCADE];
31+
{% endhighlight %}
32+
33+
34+
### Parameters
35+
36+
<dl>
37+
<dt><code><em>DATABASE|SCHEMA</em></code></dt>
38+
<dd>`DATABASE` and `SCHEMA` mean the same thing, either of them can be used.</dd>
39+
</dl>
40+
41+
<dl>
42+
<dt><code><em>IF EXISTS</em></code></dt>
43+
<dd>If specified, no exception is thrown when the database does not exist.</dd>
44+
</dl>
45+
46+
<dl>
47+
<dt><code><em>RESTRICT</em></code></dt>
48+
<dd>If specified, will restrict dropping a non-empty database and is enabled by default.</dd>
49+
</dl>
50+
51+
<dl>
52+
<dt><code><em>CASCADE</em></code></dt>
53+
<dd>If specified, will drop all the associated tables and functions.</dd>
54+
</dl>
55+
56+
### Example
57+
{% highlight sql %}
58+
-- Create `inventory_db` Database
59+
CREATE DATABASE inventory_db COMMENT 'This database is used to maintain Inventory';
60+
61+
-- Drop the database and it's tables
62+
DROP DATABASE inventory_db CASCADE;
63+
+---------+
64+
| Result |
65+
+---------+
66+
+---------+
67+
68+
-- Drop the database using IF EXISTS
69+
DROP DATABASE IF EXISTS inventory_db CASCADE;
70+
+---------+
71+
| Result |
72+
+---------+
73+
+---------+
74+
75+
{% endhighlight %}
76+
77+
### Related statements
78+
- [CREATE DATABASE](sql-ref-syntax-ddl-create-database.html)
79+
- [DESCRIBE DATABASE](sql-ref-syntax-aux-describe-database.html)
80+
- [SHOW DATABASES](sql-ref-syntax-aux-show-databases.html)

0 commit comments

Comments
 (0)