PostgreSQL — Story of the World’s Most Loved Advances Open Source Database (Part 2)

PART 2: Create database and PSQL commands

Alright! In the previous article (Part 1), we saw, why PostgreSQL is so important to learn. And we have pretty much set up our environment to go ahead with some queries.

FIRST thing FIRST:

As I had promised that, I’ll not go with any GUI throughout this series. So, Let’s open our PSQL terminal.

1. Create your database:

Do you remember, on (PART 1), we saw there are 3 default databases Postgres, template0, and then template1. So by default, these are generated for us but we can create our own database. To do so we need to use a command that creates a fresh database for us. Let’s create our own postgreSQL database.

CREATE DATABASE mydb;

2. Connect to your database:

Once your DB has been created. You can connect to the new database:

\c mydb

3. List available tables in your databases

In a relational database, a table is a collection of related data held in a table format within a database. It consists of columns and rows.

Data Engineer | Python Programmer | Instructor | Tech Enthusiast