This video is available to students only

How to Start Using PostgreSQL and Migrate From MongoDB

This lesson is an introduction to the popular and widely used open-source SQL database, PostgreSQL.

PostgreSQL#

We’ll use PostgreSQL as our SQL database. PostgreSQL is a powerful relational database and has the highest rating for SQL compliance. It is a fully open-source project and is developed and maintained by a large and active community. PostgreSQL has earned a strong reputation for its reliability and robust feature set, becoming the relational database of choice for many developers.

Installation#

To install PostgreSQL, head over to their official download page and select the operating system you use. Next, click the “Download the installer” button and choose the latest version for your operating system.

Once the download is complete, run the PostgreSQL installer. Make sure you select all the components for installation.

If you're installing PostgreSQL for the first time, you'll be asked to:

  • Pick a directory to store your data.

  • Create a password for a superuser.

  • Choose a port number for your PostgreSQL server (for this, we recommend to use the default 5432 port number).

pgAdmin#

Once the installation is complete, you should be able to find pgAdmin on your computer. pgAdmin is an application that can be used to create, modify, and delete your PostgreSQL databases using either SQL (Structured Query Language) or a GUI (Graphical User Interface).

When you launch pgAdmin, you will be asked to enter a password. This is the same password you set up during the installation process.

On the left navigation panel, you'll find your databases. To create a new database, simply right-click on “Databases” and select “Create/Database…”.

Next, enter a name for your new database (e.g. test_db_001). Then, hit "Save".

To create a table for your database, select “Schemas” on the left-hand panel, then right-click on “Tables”, and then select “Create/Table...”.

In the Create-Table dialog window, enter a name for your new table (e.g. test_users).

Next, navigate to the “Columns” tab to start building a schema for your new table. Click the “+” icon to add a new column.

Start a new discussion. All notification go to the author.