This section explains the Tajo DDL commands. Tajo has a built-in database named default.
Create Database is a statement used to create a database in Tajo. The syntax for this statement is as follows −
CREATE DATABASE [IF NOT EXISTS] <database_name>
default> default> create database if not exists test;
The above query will generate the following result.
OK
Database is the namespace in Tajo. A database can contain multiple tables with a unique name.
To check the current database name, issue the following command −
default> \c
The above query will generate the following result.
You are now connected to database "default" as user “user1". default>
As of now, you have created a database named “test”. The following syntax is used to connect the “test” database.
\c <database name>
default> \c test
The above query will generate the following result.
You are now connected to database "test" as user “user1”. test>
You can now see the prompt changes from default database to test database.
To drop a database, use the following syntax −
DROP DATABASE <database-name>
test> \c default You are now connected to database "default" as user “user1". default> drop database test;
The above query will generate the following result.
OK