DDL
DDL statements are mainly responsible for creating, altering, and dropping tables, indexes, and users. DDL statements typically comprise CREATE
, ALTER
, and DROP
operations. In this section, we will go over various DDL operations and their syntax, starting with CREATE
.
CREATE
CREATE
is the keyword used for creating something new such as a database, schema, table, view, or user.
A CREATE DATABASE
statement accepts the following parameters:
IF NOT EXISTS
: Creates a new database, only if the database with the same name does not exist previouslydatabase_name
: Name of the database to be created
The following databases are created by default and are used internally by CockroachDB:
postgres
: Empty database that is provided for compatibility with Postgres clientssystem
: A database that contains CockroachDB metadata and that is read-only
The following default database is used for default connections:
defaultdb
: Used when a client...