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.
- Read: Netezza SQL Identifiers
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:
- Netezza Create user Command and Examples
- IBM Netezza Alter Table command and Examples
- Netezza Create Table command and Examples
- IBM Netezza alter user Command and Examples