-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-28802][DOC][SQL]Document DESCRIBE DATABASE statement in SQL Reference #25528
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
Changes from 4 commits
347150a
9c0733d
5afda1e
25db698
1bfd32e
59b4f1d
7ecdce1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,5 +18,79 @@ license: | | |
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --- | ||
| ### Description | ||
| | ||
| `DESCRIBE DATABASE` statement returns the metadata of an existing database. The metadata information includes database | ||
| name, database comment, and database location on the filesystem. If the optional `EXTENDED` option is specified, it | ||
| returns the basic metadata information along with the database properties. The `DATABASE` and `SCHEMA` are | ||
| interchangeable. | ||
|
|
||
| **This page is under construction** | ||
| ### Syntax | ||
| {% highlight sql %} | ||
| {DESC | DESCRIBE} DATABASE [EXTENDED] db_name | ||
| {% endhighlight %} | ||
|
|
||
| ### Parameters | ||
| <dl> | ||
| <dt><code><em>db_name</em></code></dt> | ||
| <dd> | ||
| Specifies a name of an existing database or an existing schema in the syetem. If the name does not exist, an | ||
| exception is thrown. The name is case insensitive, it is stored as low case in SPARK<br><br> | ||
| </dd> | ||
| </dl> | ||
|
|
||
| ### Example | ||
| {% highlight sql %} | ||
| -- Create employees DATABASE | ||
| CREATE DATABASE EMPLOYEES COMMENT 'For software companies'; | ||
|
|
||
| -- Describe employees DATABASE. | ||
| -- Returns Database Name, Description and Root location of the filesystem for the employees DATABASE | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kevinyu98 Can we please put DATABASE in another line with a comment marker. ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
| DESCRIBE DATABASE Employees; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kevinyu98 ditto.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed |
||
| +-------------------------+-----------------------------+ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kevinyu98 Can we keep the results 2 spaces to the right to match other PRs.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed |
||
| |database_description_item|database_description_value | | ||
| +-------------------------+-----------------------------+ | ||
| |Database Name |employees | | ||
| |Description |For software companies | | ||
| |Location |file:/Users/Temp/employees.db| | ||
| +-------------------------+-----------------------------+ | ||
| {% endhighlight %} | ||
|
|
||
| {% highlight sql %} | ||
| -- Create employees DATABASE | ||
| CREATE DATABASE EMPLOYEES COMMENT 'For software companies'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kevinyu98 lowercase employees.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
|
||
| -- Alter employees database to set DBPROPERTIES | ||
| ALTER DATABASE EMPLOYEES SET DBPROPERTIES ('Create-by' = 'Kevin', 'Create-date' = '09/01/2019'); | ||
|
|
||
| -- Describe employees DATABASE with EXTENDED option to the database properties | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kevinyu98 "to return additional database properties"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
| DESCRIBE DATABASE EXTENDED employees; | ||
| +-------------------------+---------------------------------------------+ | ||
| |database_description_item|database_description_value | | ||
| +-------------------------+---------------------------------------------+ | ||
| |Database Name |employees | | ||
| |Description |For software companies | | ||
| |Location |file:/Users/Temp/employees.db | | ||
| |Properties |((Create-by,kevin), (Create-date,09/01/2019))| | ||
| +-------------------------+---------------------------------------------+ | ||
| {% endhighlight %} | ||
|
|
||
| {% highlight sql %} | ||
| -- Create deployment SCHEMA | ||
| CREATE SCHEMA DEPLOYMENT comment 'Deployment environment'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kevinyu98 lowercase ..
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
|
||
| -- Describe deployment, the DATABASE and SCHEMA are interchangeable, their meaning are the same. | ||
| DESC DATABASE DEPLOYMENT; | ||
| +-------------------------+------------------------------+ | ||
| |database_description_item|database_description_value | | ||
| +-------------------------+------------------------------+ | ||
| |Database Name |deployment | | ||
| |Description |Deployment environment | | ||
| |Location |file:/Users/Temp/deployment.db| | ||
| +-------------------------+------------------------------+ | ||
| {% endhighlight %} | ||
|
|
||
| ### Related Statements | ||
| - [DESCRIBE FUNCTION](sql-ref-syntax-aux-describe-function.html) | ||
| - [DESCRIBE TABLE](sql-ref-syntax-aux-describe-table.html) | ||
| - [DESCRIBE QUERY](sql-ref-syntax-aux-describe-query.html) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinyu98 lets use lowercase for
EMPLOYEESto match other PRS..There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dilipbiswal sure