Tuesday, 21 June 2022

Hive: Create a database

Syntax

CREATE DATABASE|SCHEMA [IF NOT EXISTS] <databaseName>

 

Example

CREATE DATABASE IF NOT EXISTS demo_db1;

CREATE SCHEMA IF NOT EXISTS demo_db2;

 

hive> CREATE DATABASE IF NOT EXISTS demo_db1;
OK
Time taken: 0.294 seconds
hive> ;
hive> ;
hive> CREATE SCHEMA IF NOT EXISTS demo_db2;
OK
Time taken: 0.04 seconds
hive> ;
hive> ;
hive> SHOW DATABASES;
OK
default
demo_db1
demo_db2
Time taken: 0.176 seconds, Fetched: 3 row(s)

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment