Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

On this page

CREATE SCHEMA

Updated on 2022-11-18 GMT+08:00

CREATE (DATABASE|SCHEMA) [IF NOT EXISTS] database_name

[COMMENT database_comment]

[LOCATION hdfs_path]

[WITH DBPROPERTIES (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

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback