DESCRIBE DATABASE

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.

Syntax

  1. { DESC | DESCRIBE } DATABASE [ EXTENDED ] db_name

Parameters

  • db_name

    Specifies a name of an existing database or an existing schema in the system. If the name does not exist, an exception is thrown.

Examples

  1. -- Create employees DATABASE
  2. CREATE DATABASE employees COMMENT 'For software companies';
  3. -- Describe employees DATABASE.
  4. -- Returns Database Name, Description and Root location of the filesystem
  5. -- for the employees DATABASE.
  6. DESCRIBE DATABASE employees;
  7. +-------------------------+-----------------------------+
  8. |database_description_item| database_description_value|
  9. +-------------------------+-----------------------------+
  10. | Database Name| employees|
  11. | Description| For software companies|
  12. | Location|file:/Users/Temp/employees.db|
  13. +-------------------------+-----------------------------+
  14. -- Create employees DATABASE
  15. CREATE DATABASE employees COMMENT 'For software companies';
  16. -- Alter employees database to set DBPROPERTIES
  17. ALTER DATABASE employees SET DBPROPERTIES ('Create-by' = 'Kevin', 'Create-date' = '09/01/2019');
  18. -- Describe employees DATABASE with EXTENDED option to return additional database properties
  19. DESCRIBE DATABASE EXTENDED employees;
  20. +-------------------------+---------------------------------------------+
  21. |database_description_item| database_description_value|
  22. +-------------------------+---------------------------------------------+
  23. | Database Name| employees|
  24. | Description| For software companies|
  25. | Location| file:/Users/Temp/employees.db|
  26. | Properties|((Create-by,kevin), (Create-date,09/01/2019))|
  27. +-------------------------+---------------------------------------------+
  28. -- Create deployment SCHEMA
  29. CREATE SCHEMA deployment COMMENT 'Deployment environment';
  30. -- Describe deployment, the DATABASE and SCHEMA are interchangeable, their meaning are the same.
  31. DESC DATABASE deployment;
  32. +-------------------------+------------------------------+
  33. |database_description_item|database_description_value |
  34. +-------------------------+------------------------------+
  35. | Database Name| deployment|
  36. | Description| Deployment environment|
  37. | Location|file:/Users/Temp/deployment.db|
  38. +-------------------------+------------------------------+