PostgreSQL - Day 1

Learn PostgreSQL - Day 1

I began learning PostgreSQL by Learn PostgreSQL Tutorial - Full Course for Beginners

I record down what I’ve learned.

1. What is a Database

A database is a place where you can store, manipulate and retrieve data.

2. PostgreSQL and Relational Database

Postgres is the actual database engine.

SQL is the acronym for Structured Query Language.

SQL is a programming language that manages data held in relational databases.

How data is stored

  • Stores data in tables
    • are formed by columns and rows.
    • store attributes of objects as columns

What is a relational database?

It’s simply a relation between one or more tables.

3. Introduce PostgreSQL

Postgres is an Object-relational database management system.

  • modern
  • open source

4. Postgres installation

The easiest way is to install the Postgres.app on Mac.

  • Additional Release provides different versions of Postgres that you can switch

After installation, you can start the app and see the GUI of the PostgreSQL server.

5. GUI Clients vs. Terminal/CMD Clients

Now we have the running server. We have to manage data by using a client connected to the server.

There are many types of clients

  • GUI client
  • CLI
  • Application

6. Setup PSQL (MAC OS)

  1. Start the server

  2. Double click on the database will open the terminal

  3. Add Postgres path to the shell

vim ~/.zshrc

add the line below

export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/14/bin/"

then apply the change

source ~/.zshrc

Now you can execute psql in the shell directly!

comments

comments powered by Disqus