Netezza Create, Drop, Rename Database Commands and Examples

  • Post author:
  • Post last modified:February 27, 2018
  • Post category:Netezza
  • Reading time:2 mins read

Using Netezza SQL, you can create, drop, rename and change the database owners. These are some important commands you should know if you are working as a Netezza database administrator. In this article, we will check Netezza create, drop, rename database commands and some of examples.

Netezza Create Database Command

You can use CREATE DATABASE command to create new database in Netezza system:

system(admin)=> CREATE DATABASE newdb;
CREATE DATABASE

Database names can be up to a maximum length of 128 bytes, system displays an error message if exceed the length.

Netezza Drop Database Command

You can use DROP DATABASE command to drop database in Netezza system:

system(admin)=> DROP DATABASE newdb;
DROP DATABASE

Dropping the Netezza database removes the entries for an existing database and deletes the directory that contains the data. Entire data and objects will be removed from the Netezza system.

Netezza Rename Database Command

You can use ALTER DATABASE command to rename the database in Netezza system:

system(admin)=> ALTER DATABASE newdb RENAME TO anothernewdb;
ALTER DATABASE

The data and type remains same after rename the database.

You should recompile all the view those are associated with the old database to point to renamed database.

Netezza Change Ownership of database

You can use ALTER DATABASE command to change the database owner in Netezza system:

system(admin)=> ALTER DATABASE anothernewdb OWNER TO black;
ALTER DATABASE

The only prerequisites here is that, the new owner must be a current used of the system. Create the user first if not exists.

Read: