Hello viewer.
I am SO glad you could join me today, because I am going to introduce you to your new friend:
PostgreSQL.
This open source database is taking the world by storm, both on the ground and up there
in the cloud.
It gives you an advanced relational database for the low, low price of free.
And if you convert free into your local currency, it is still free.
You cannot beat that with a stick, am I right?
I am right.
Let’s take a moment and stare at the name.
This is pronounced “Post gres SQL”, but most people simply say “Post gres” for
short.
Because let’s be honest - who has time for syllables?
We have things to do and data to store.
To begin, let’s take a moment and stare at the name some more...
The prefix “post” hints that something came before “gres”.
And this is true.
To understand the name, we have to go far back in time to the 1970s.
The place?
Berkeley, California.
The time?
The 1970s.
There is a lot of unfortunate fashion ... and a world class university.
Scientists are hard at work on a research project called “Ingres.”
There was much rejoicing...
But it’s not perfect, so in the 1980s a follow-up project was started to fix some
problems with Ingres.
Because it came after “ingres,” this project was called “POSTgres.”
Very clever, you computer scientists.
And then in the 1990s, even MORE improvements were made.
Instead of using the “POSTQUEL query language,” the database was updated to support SQL which
was taking the world by storm.
PostgreSQL was born and there was even more rejoicing… and downloading...
To install Postgres, visit its official website “postgresql.org”
If you visit this page and things look different than they do here, do not panic.
Websites change, and you should not fear change…
unless the change is scary, then you should be terrified.
Click download…
And select a version for the operating system you are using.
We will demonstrate the installation procedure using the EnterpriseDB installer.
I do not know about you, but I like to live on the edge, so I will be choosing the most
recent version of Postgres.
If you see a more recent version than the one listed here, congratulations future viewer.
To build suspense before installing Postgres, let’s take a trip back in time to when we
first visited the Postgres home page.
That was a crazy time...
Notice that there are elephants everywhere.
Why is this?
For starters, elephants are beautiful and amazing animals.
Big, majestic...
But the main reason is that “elephants never forget.”
And you do not want your database to forget…
A nice choice for a mascot.
Well done, Postgres.
We are now ready to install Postgres, so run the installer…
We will install the pgAdmin component separately, so uncheck that box.
You will definitely want to install the command line tools, because engineers get double respect
points when typing in commands versus using a GUI.
But do not worry.
We will install the pgAdmin GUI shortly so you can use that when no one is looking.
I am going to store the Postgres data on a separate hard drive than the OS drive.
If you only have a single hard drive, do not panic.
No harm will befall you.
And now you must make an important decision: select a superuser password.
It better not be “password.”
If you are going to be a super user, you need to pick a super password.
Next, you can select the port for your server.
Postgres defaults to 5-4-3-2 which is what we will use.
Oh good, more questions…
Default locale…
Next...
The end is in sight.
Verify everything is correct and click “next” again.
You have got to be kidding me…
Next…
This is what I like to see.
Status bars, rapidly changing text, and the promise of a new database in a few seconds…
Or maybe a few minutes.
I will exercise my right to be impatient and deselect the Stack Builder option so we can
start to build our database.
But first, we will install a Postgres GUI tool.
The one we will install is called “pgAdmin.”
You may wonder what the “pg” stands for.
Pretty Good…
I think…
To download the tool, go to “pgAdmin.org”.
I see an elephant, so we must be at the right place.
From here we know the drill.
Click download…
Select your operating system.
Be bold and use the most recent version…
As is typically the case when installing new software, click “Next” until you get to
a license agreement with a lot of text in all caps.
I always include a similar warning on my CV.
… And install.
Now that we have installed both the Postgres database and the pgAdmin tool, let us see
the fruits of our labor.
Start the pgAdmin tool.
Congratulations.
We have made it to the starting line.
We now begin our tour of the pgAdmin interface.
The pgAdmin interface should feel inviting.
The Postgres elephant even says “Welcome” to us in a cordial font.
At the top you have a menubar.
Underneath you have several tabs, with the Dashboard already selected.
There are links to help you get started.
Create a new server…
Configure the pgAdmin GUI...
And resources for getting help.
My favorite is the PostgreSQL user’s manual.
At over 3,500 pages long, it is a fascinating manual.
There is even an audiobook version available that is only 400 hours long.
I saved the best for last.
The sidebar.
At the top, we have a “server group” called “servers.”
As the name suggests, a “server group” is a container for organizing your servers.
The “1” after the name “Servers” lets you know there is currently one server in
this group.
The default server is called “PostgreSQL 11” and is granted Elephant Icon Status.
If you expand this server you will see additional categories:
Databases Login and Group Roles
And Tablespaces We have come this far to see a Postgres database,
so let’s not be distracted.
If you expand “Databases” you will see the “postgres” database.
You may or may not see databases called “template0” and “template1”.
If you do see them, leave them alone.
Trust me…
I once knew someone {Michael Harrison} who deleted these template databases on windows
and had to spend a fair amount of time cleaning up the registry and reinstalling the database
in order to return things to working order.
To create a database, right click on “Databases” and select create … database …
We will create a database called “socratica.”
The owner is “postgres” the superuser.
This is also the title of an upcoming action film.
Before we click “save”, let us look at the “SQL” tab.
This shows the SQL command that will be executed in order to create this database.
Whenever you are making a change to a database using pgAdmin, I would suggest looking at
the SQL tab.
It will strengthen your understanding of SQL and provide you with useful code snippets
you can use in your scripts and code.
We return now to the “General” tab and “Save.”
Our database has been created.
To see how many tables there are, open the “Schemas” folder.
By default, this database has a public schema.
Expanding the public schema reveals a long list of features you can use when building
your database.
The most essential are your tables.
And by clicking on this, you can see our “socratica” database currently has no tables.
And by the looks of it, there are no chairs, either…
We will fix this in a future video.
Now that you have installed Postgres, you can tell everyone you meet that you
have installed Postgres.
But wait, it gets better.
You are no longer just a user - you are now a superuser.
The world of data is yours for the storing.
So crack those knuckles, grab that manual, and be sure to lift with your knees.
Because manual heavy.
Subscribe to Socratica for more excellent videos.