CREATE SCHEMA
CREATE (DATABASE|SCHEMA) [IF NOT EXISTS] database_name
[COMMENT database_comment]
[LOCATION hdfs_path]
[WITH DBPROPERTIES (property_name=property_value,...)];
CREATE (DATABASE|SCHEMA) [IF NOT EXISTS] database_name
[WITH (property_name=property_value,...)]
Description
This statement is used to create an empty schema. A schema is a container for tables, views, and other database objects. If the optional parameter IF NOT EXISTS is specified and a schema with the same name already exists in the system, no error is reported.
The default schema path is hdfs://hacluster/user/hive/warehouse/.
Example
- Creating a schema named "web":
CREATE SCHEMA web;
- Create a schema in the specified path. The following is an example:
CREATE SCHEMA test_schema_5 LOCATION '/user/hive';
- Run the following command to create a schema named sales in the catalog named Hive:
CREATE SCHEMA hive.sales;
- If the schema named traffic does not exist in the current catalog, run the following command to create a schema named traffic:
CREATE SCHEMA IF NOT EXISTS traffic;
- Create a schema with attributes:
CREATE DATABASE createtestwithlocation COMMENT 'Holds all values' LOCATION '/user/hive/warehouse/create_new' WITH dbproperties('name'='akku', 'id' ='9'); --Use the describe schema|database statement to query the schema created: describe schema createtestwithlocation;
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot