From 347150a4d5ca977e8dd2db34c32ede8013aae59d Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Tue, 20 Aug 2019 17:04:34 -0700 Subject: [PATCH 1/7] add describe database doc --- docs/sql-ref-syntax-aux-describe-database.md | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/sql-ref-syntax-aux-describe-database.md b/docs/sql-ref-syntax-aux-describe-database.md index 5d1c9deb13a7a..0b54c05d08b48 100644 --- a/docs/sql-ref-syntax-aux-describe-database.md +++ b/docs/sql-ref-syntax-aux-describe-database.md @@ -19,4 +19,25 @@ license: | limitations under the License. --- -**This page is under construction** +**Syntax** +{% highlight sql %} +DESCRIBE DATABASE [EXTENDED] db_name +{% endhighlight %} + +**Example** +{% highlight sql %} +DESCRIBE DATABASE EXTENDED tempdb +{% endhighlight %} + + + +Return the metadata of an existing database(name, comment and location). If the database does not exist, + +an exception is thrown. + +When `extended` is specified, it also shows the database's properties. + +You can use the abbreviation `DESC` for the `DESCRIBE` statement. + + + From 9c0733d929c13df31ab01664b015a62d767df450 Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Tue, 20 Aug 2019 22:38:29 -0700 Subject: [PATCH 2/7] adjust the style --- docs/sql-ref-syntax-aux-describe-database.md | 25 +++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/docs/sql-ref-syntax-aux-describe-database.md b/docs/sql-ref-syntax-aux-describe-database.md index 0b54c05d08b48..5ac302ea9eadc 100644 --- a/docs/sql-ref-syntax-aux-describe-database.md +++ b/docs/sql-ref-syntax-aux-describe-database.md @@ -18,26 +18,23 @@ license: | See the License for the specific language governing permissions and limitations under the License. --- +### Description +​ +Return the metadata of an existing database(name, comment and location). If the database does not exist, +an exception is thrown. + +When `extended` is specified, it also shows the database's properties. + +You can use the abbreviation `DESC` for the `DESCRIBE` statement. -**Syntax** +### Syntax {% highlight sql %} -DESCRIBE DATABASE [EXTENDED] db_name +[DESC | DESCRIBE] DATABASE [EXTENDED] db_name {% endhighlight %} -**Example** +### Example {% highlight sql %} DESCRIBE DATABASE EXTENDED tempdb {% endhighlight %} - -Return the metadata of an existing database(name, comment and location). If the database does not exist, - -an exception is thrown. - -When `extended` is specified, it also shows the database's properties. - -You can use the abbreviation `DESC` for the `DESCRIBE` statement. - - - From 5afda1e5853de6c991bdce835c7b131eed7c2fc7 Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Thu, 22 Aug 2019 08:21:02 -0700 Subject: [PATCH 3/7] address comments --- docs/sql-ref-syntax-aux-describe-database.md | 31 +++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/sql-ref-syntax-aux-describe-database.md b/docs/sql-ref-syntax-aux-describe-database.md index 5ac302ea9eadc..93a4f8f139cea 100644 --- a/docs/sql-ref-syntax-aux-describe-database.md +++ b/docs/sql-ref-syntax-aux-describe-database.md @@ -20,11 +20,9 @@ license: | --- ### Description ​ -Return the metadata of an existing database(name, comment and location). If the database does not exist, +Return the metadata of an existing database (name, comment and location). If the database does not exist, an exception is thrown. - -When `extended` is specified, it also shows the database's properties. - +When `EXTENDED` is specified, it also shows the database's properties. You can use the abbreviation `DESC` for the `DESCRIBE` statement. ### Syntax @@ -34,7 +32,32 @@ You can use the abbreviation `DESC` for the `DESCRIBE` statement. ### Example {% highlight sql %} +-- Returns Database Name, Description and location for the tempdb DATABASE + +DESCRIBE DATABASE tempdb ++-------------------------+--------------------------+ +|database_description_item|database_description_value| ++-------------------------+--------------------------+ +| Database Name| tempdb| +| Description| | +| Location| file:/Users/Temp/...| ++-------------------------+--------------------------+ + +{% endhighlight %} + +{% highlight sql %} +-- Returns Database Name, Description, Location for the tempdb DATABASE, the additional information displayed by the EXTENDED keyword is the database properties. + DESCRIBE DATABASE EXTENDED tempdb ++-------------------------+--------------------------+ +|database_description_item|database_description_value| ++-------------------------+--------------------------+ +| Database Name| tempdb| +| Description| | +| Location| file:/Users/Temp/...| +| Properties| ((a,a))| ++-------------------------+--------------------------+ + {% endhighlight %} From 25db698de9523d839b9a07d7c6b58c8be739f11e Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Wed, 4 Sep 2019 00:12:26 -0700 Subject: [PATCH 4/7] adjust the space --- docs/sql-ref-syntax-aux-describe-database.md | 85 ++++++++++++++------ 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/docs/sql-ref-syntax-aux-describe-database.md b/docs/sql-ref-syntax-aux-describe-database.md index 93a4f8f139cea..6c9b3b993bfb7 100644 --- a/docs/sql-ref-syntax-aux-describe-database.md +++ b/docs/sql-ref-syntax-aux-describe-database.md @@ -20,44 +20,77 @@ license: | --- ### Description ​ -Return the metadata of an existing database (name, comment and location). If the database does not exist, -an exception is thrown. -When `EXTENDED` is specified, it also shows the database's properties. -You can use the abbreviation `DESC` for the `DESCRIBE` statement. +`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. ### Syntax {% highlight sql %} -[DESC | DESCRIBE] DATABASE [EXTENDED] db_name +{DESC | DESCRIBE} DATABASE [EXTENDED] db_name {% endhighlight %} +### Parameters +
+
db_name
+
+ 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

+
+
+ ### Example {% highlight sql %} --- Returns Database Name, Description and location for the tempdb DATABASE - -DESCRIBE DATABASE tempdb -+-------------------------+--------------------------+ -|database_description_item|database_description_value| -+-------------------------+--------------------------+ -| Database Name| tempdb| -| Description| | -| Location| file:/Users/Temp/...| -+-------------------------+--------------------------+ +-- 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 +DESCRIBE DATABASE Employees; ++-------------------------+-----------------------------+ +|database_description_item|database_description_value | ++-------------------------+-----------------------------+ +|Database Name |employees | +|Description |For software companies | +|Location |file:/Users/Temp/employees.db| ++-------------------------+-----------------------------+ {% endhighlight %} {% highlight sql %} --- Returns Database Name, Description, Location for the tempdb DATABASE, the additional information displayed by the EXTENDED keyword is the database properties. - -DESCRIBE DATABASE EXTENDED tempdb -+-------------------------+--------------------------+ -|database_description_item|database_description_value| -+-------------------------+--------------------------+ -| Database Name| tempdb| -| Description| | -| Location| file:/Users/Temp/...| -| Properties| ((a,a))| -+-------------------------+--------------------------+ +-- Create employees DATABASE +CREATE DATABASE EMPLOYEES COMMENT 'For software companies'; + +-- 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 +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'; + +-- 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) From 1bfd32e39b46bb95c5dd600681de894ef49f5703 Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Thu, 5 Sep 2019 13:07:51 -0700 Subject: [PATCH 5/7] address comments --- docs/sql-ref-syntax-aux-describe-database.md | 68 ++++++++++---------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/docs/sql-ref-syntax-aux-describe-database.md b/docs/sql-ref-syntax-aux-describe-database.md index 6c9b3b993bfb7..b499bb1092b40 100644 --- a/docs/sql-ref-syntax-aux-describe-database.md +++ b/docs/sql-ref-syntax-aux-describe-database.md @@ -35,59 +35,57 @@ interchangeable.
db_name
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

+ exception is thrown.

### Example {% highlight sql %} -- Create employees DATABASE -CREATE DATABASE EMPLOYEES COMMENT 'For software companies'; +CREATE DATABASE employees COMMENT 'For software companies'; -- Describe employees DATABASE. --- Returns Database Name, Description and Root location of the filesystem for the employees DATABASE -DESCRIBE DATABASE Employees; -+-------------------------+-----------------------------+ -|database_description_item|database_description_value | -+-------------------------+-----------------------------+ -|Database Name |employees | -|Description |For software companies | -|Location |file:/Users/Temp/employees.db| -+-------------------------+-----------------------------+ -{% endhighlight %} +-- Returns Database Name, Description and Root location of the filesystem +-- for the employees DATABASE. +DESCRIBE DATABASE employees; + +-------------------------+-----------------------------+ + |database_description_item|database_description_value | + +-------------------------+-----------------------------+ + |Database Name |employees | + |Description |For software companies | + |Location |file:/Users/Temp/employees.db| + +-------------------------+-----------------------------+ -{% highlight sql %} -- Create employees DATABASE -CREATE DATABASE EMPLOYEES COMMENT 'For software companies'; +CREATE DATABASE employees COMMENT 'For software companies'; -- Alter employees database to set DBPROPERTIES -ALTER DATABASE EMPLOYEES SET DBPROPERTIES ('Create-by' = 'Kevin', 'Create-date' = '09/01/2019'); +ALTER DATABASE employees SET DBPROPERTIES ('Create-by' = 'Kevin', 'Create-date' = '09/01/2019'); --- Describe employees DATABASE with EXTENDED option to the database properties +-- Describe employees DATABASE with EXTENDED option to return additional database properties 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 %} + +-------------------------+---------------------------------------------+ + |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))| + +-------------------------+---------------------------------------------+ -{% highlight sql %} -- Create deployment SCHEMA -CREATE SCHEMA DEPLOYMENT comment 'Deployment environment'; +CREATE SCHEMA deployment comment 'Deployment environment'; -- 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| -+-------------------------+------------------------------+ +DESC DATABASE deployment; + +-------------------------+------------------------------+ + |database_description_item|database_description_value | + +-------------------------+------------------------------+ + |Database Name |deployment | + |Description |Deployment environment | + |Location |file:/Users/Temp/deployment.db| + +-------------------------+------------------------------+ + {% endhighlight %} ### Related Statements From 59b4f1d3efeac15cf14723eace4b74f560601361 Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Thu, 5 Sep 2019 13:44:07 -0700 Subject: [PATCH 6/7] remove br --- docs/sql-ref-syntax-aux-describe-database.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sql-ref-syntax-aux-describe-database.md b/docs/sql-ref-syntax-aux-describe-database.md index b499bb1092b40..d6a3e39e2339f 100644 --- a/docs/sql-ref-syntax-aux-describe-database.md +++ b/docs/sql-ref-syntax-aux-describe-database.md @@ -35,7 +35,7 @@ interchangeable.
db_name
Specifies a name of an existing database or an existing schema in the syetem. If the name does not exist, an - exception is thrown.

+ exception is thrown.
From 7ecdce19a5cab3d896682e2c1f2f9823bc0035a7 Mon Sep 17 00:00:00 2001 From: Xiao Li Date: Thu, 5 Sep 2019 16:21:32 -0700 Subject: [PATCH 7/7] Update sql-ref-syntax-aux-describe-database.md --- docs/sql-ref-syntax-aux-describe-database.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sql-ref-syntax-aux-describe-database.md b/docs/sql-ref-syntax-aux-describe-database.md index d6a3e39e2339f..c94383a82ef7e 100644 --- a/docs/sql-ref-syntax-aux-describe-database.md +++ b/docs/sql-ref-syntax-aux-describe-database.md @@ -74,7 +74,7 @@ DESCRIBE DATABASE EXTENDED employees; +-------------------------+---------------------------------------------+ -- Create deployment SCHEMA -CREATE SCHEMA deployment comment 'Deployment environment'; +CREATE SCHEMA deployment COMMENT 'Deployment environment'; -- Describe deployment, the DATABASE and SCHEMA are interchangeable, their meaning are the same. DESC DATABASE deployment;