Today’s class is all about your preparation for your upcoming class on SQL, which would give you the ability to query for data in a relational database.

I’ve mentioned that if there’s one thing you need to know in this course, it would be on how you can query data from databases. You would be hard pressed to find a company that doesn’t use some variant of SQL to retrieve data from databases or data warehouses, and thus we are prepping for that in the next module.

Objectives

By the end of the class, we want to complete the installation of the Postgres server and be able to see it run in your local machine. If we can’t get this sorted in your local machine, it would be very difficult for you to follow the class in the next module.

The instructions have been uploaded into Activity 1 in your Gitlab school repo, under the Resources folder. Both instructions for Mac and Windows are included.

Jonathan’s Notes

  • There are a lot of ways to install a SQL server. Schools typically teach using the Graphical User Interface (GUI) installer, but for more seasoned folks, we install it via a command line.
    • That’s because we typically don’t install a GUI on a remote database server, but rather we install a GUI locally within our local machine to access a remote database server due to security reasons (We typically don’t allow web access for sensitive data) and overhead in terms of resources. Thus, we don’t have the luxury of installing using a GUI.
    • Thus, don’t be alarmed if you find our installation patterns are different between work and school. They are using the same engine, just different ways and presentation.
  • PostgreSQL is only 1 flavor of databases. There is MySQL, which I’m more used to and still using at work, Microsoft SQL and many more variants.
    • You may have the chance to learn about the different database engines in your career if you have many different sources to work with. However, you do not need to know every engine. Just one of them would give you enough knowledge to be effective at work, and you will learn about the different nuances as you progress in your work.

Installing PostgreSQL

Caveats with the school notes

You will find that the schools’ notes are asking you to install version 14.7 at the time of writing, but the website link they gave is probably a couple of major versions ahead.

  • That’s normal because database systems are updated regularly for security patches and upgrades. The school notes aren’t able to keep up with the latest stable version, but that’s not going to affect your learning or school activities.
  • However, I always try to install the latest stable version (at the time of writing, it is at 16.2) even when teaching class so that I don’t have to worry about using an outdated version.

Installation on Windows

The school notes suggests to create a free account prior to downloading the software, but I was able to download Postgres 16 using this link instead: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

If you’re using the school’s notes links to download, install PostgreSQL as shown below:

Installing on Macs

Use the link given in the school notes where you don’t have to create a free account to download PostgreSQL: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

  • Same for Windows, uncheck the Stack Builder during installation for Mac.
  • The school’s notes are fine to follow.
  • There is an extra step where you have to install pgAdmin 4 with this link here: https://www.pgadmin.org/download/pgadmin-4-macos/
    • Install the latest version that suits your operating system (Apple Silicon should use arm64, Intel machines should use x86) and you should be good to go.

How to tell you are successful with your installation?

Run your pgAdmin 4 app in your Windows or Mac machines, and you should see a dashboard running like this without any problems:

We are done with the installation, and we will cover the rest of PostgreSQL in our future lessons.