How to Create, Alter, Drop and List a Redshift Database with Query Editor

How to Create a Redshift Database with Query Editor

July 21th, 2020,

In this post you will learn how to set up your first AWS Redshift database. The queries below allow you to create, delete, alter, and list a database on your Amazon Redshift instance using the AWS query editor.


Table of Contents:

Create a new database

At the first you must have already an AWS account. Connect to your AWS account Here.
The query below allows you to create a new database by running the CREATE command:

create database MyDatabase;

Alter a database

The query below allows you changes the attributes of an existing database by running the ALTER command:

Example of ALTER query:

Rename a database

alter database MyDatabase rename to MyNewDatabase;

Change the owner of a database

alter database MyNewDatabase owner to simpleuser;

Delete a database

The query below allows you delete an existing database by running the DROP command. Note that you can't drop the current database:

drop database MyTestDatabase;

List all databases from an AWS Redshift cluster

To list all the existing databases of an AWS Redshift cluster run the query below:

 SELECT * FROM pg_database;

How ERBuilder Helps

ERBuilder Data Modeler is a GUI data modeling tool that allows you to visualize, design and model databases by using entity relationship diagrams and automatically generates the most popular SQL databases including Amazon Redshift. Generate and share the data Model documentation with your team. Optimize your data model by using advanced features such as test data generation, schema compare and schema synchronization. Try now ERBuilder for 15 days FREE

DOWNLOAD NOW

Subscribe To Our Newsletter

Subscribe to our email newsletter today to receive updates of the latest news, tutorials and special offers!