kevinyu98 commented on a change in pull request #25528: 
[SPARK-28802][DOC][SQL]Document DESCRIBE DATABASE statement in SQL Reference
URL: https://github.com/apache/spark/pull/25528#discussion_r321417451
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-describe-database.md
 ##########
 @@ -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
+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 %}
+-- 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';
 
 Review comment:
   ok

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to