0001 ---
0002 layout: global
0003 title: DESCRIBE DATABASE
0004 displayTitle: DESCRIBE DATABASE
0005 license: |
0006 Licensed to the Apache Software Foundation (ASF) under one or more
0007 contributor license agreements. See the NOTICE file distributed with
0008 this work for additional information regarding copyright ownership.
0009 The ASF licenses this file to You under the Apache License, Version 2.0
0010 (the "License"); you may not use this file except in compliance with
0011 the License. You may obtain a copy of the License at
0012
0013 http://www.apache.org/licenses/LICENSE-2.0
0014
0015 Unless required by applicable law or agreed to in writing, software
0016 distributed under the License is distributed on an "AS IS" BASIS,
0017 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0018 See the License for the specific language governing permissions and
0019 limitations under the License.
0020 ---
0021
0022 ### Description
0023
0024 `DESCRIBE DATABASE` statement returns the metadata of an existing database. The metadata information includes database
0025 name, database comment, and database location on the filesystem. If the optional `EXTENDED` option is specified, it
0026 returns the basic metadata information along with the database properties. The `DATABASE` and `SCHEMA` are
0027 interchangeable.
0028
0029 ### Syntax
0030
0031 ```sql
0032 { DESC | DESCRIBE } DATABASE [ EXTENDED ] db_name
0033 ```
0034
0035 ### Parameters
0036
0037 * **db_name**
0038
0039 Specifies a name of an existing database or an existing schema in the system. If the name does not exist, an
0040 exception is thrown.
0041
0042 ### Examples
0043
0044 ```sql
0045 -- Create employees DATABASE
0046 CREATE DATABASE employees COMMENT 'For software companies';
0047
0048 -- Describe employees DATABASE.
0049 -- Returns Database Name, Description and Root location of the filesystem
0050 -- for the employees DATABASE.
0051 DESCRIBE DATABASE employees;
0052 +-------------------------+-----------------------------+
0053 |database_description_item| database_description_value|
0054 +-------------------------+-----------------------------+
0055 | Database Name| employees|
0056 | Description| For software companies|
0057 | Location|file:/Users/Temp/employees.db|
0058 +-------------------------+-----------------------------+
0059
0060 -- Create employees DATABASE
0061 CREATE DATABASE employees COMMENT 'For software companies';
0062
0063 -- Alter employees database to set DBPROPERTIES
0064 ALTER DATABASE employees SET DBPROPERTIES ('Create-by' = 'Kevin', 'Create-date' = '09/01/2019');
0065
0066 -- Describe employees DATABASE with EXTENDED option to return additional database properties
0067 DESCRIBE DATABASE EXTENDED employees;
0068 +-------------------------+---------------------------------------------+
0069 |database_description_item| database_description_value|
0070 +-------------------------+---------------------------------------------+
0071 | Database Name| employees|
0072 | Description| For software companies|
0073 | Location| file:/Users/Temp/employees.db|
0074 | Properties|((Create-by,kevin), (Create-date,09/01/2019))|
0075 +-------------------------+---------------------------------------------+
0076
0077 -- Create deployment SCHEMA
0078 CREATE SCHEMA deployment COMMENT 'Deployment environment';
0079
0080 -- Describe deployment, the DATABASE and SCHEMA are interchangeable, their meaning are the same.
0081 DESC DATABASE deployment;
0082 +-------------------------+------------------------------+
0083 |database_description_item|database_description_value |
0084 +-------------------------+------------------------------+
0085 | Database Name| deployment|
0086 | Description| Deployment environment|
0087 | Location|file:/Users/Temp/deployment.db|
0088 +-------------------------+------------------------------+
0089 ```
0090
0091 ### Related Statements
0092
0093 * [DESCRIBE FUNCTION](sql-ref-syntax-aux-describe-function.html)
0094 * [DESCRIBE TABLE](sql-ref-syntax-aux-describe-table.html)
0095 * [DESCRIBE QUERY](sql-ref-syntax-aux-describe-query.html)