Connecting to our Database
If you look at the second tab in our learning interface it says PgAdmin4. Go ahead and click that tab which should spawn a new browser window or tab. You may have to wait a few seconds while the PGAdmin4 interface gets rendered. You should now be able to login using username admin and password password.
You should be seeing a screen that looks like this:
This is the home page for PgAdmin4. Before we can do anything meaningful we need to connect to a PostgreSQL server. There are two ways to do this:
- Click on the "Add New Server" butting in the middle of the screen.
- Right click on the Servers icon in the top left of the left navigation panel.
Let's start by doing the right click option because it will give us more flexibility.
Right click options
When you right click on the icon you should see a list of options. Go ahead and mouse over create. This will then show server group and server. If you are going to manage and interact with a lot of PostgreSQL servers then you might want to create server groups such as testing vs production. Server groups is just a logical organization in the PgAdmin interface.
In our case since we are only managing one server, go ahead and click server to bring up the new create server dialog.
Create Server Dialog
While there are quite a few boxes and tabs in this dialog, only a few of them are actually required to create a new server in PgAdmin.
On the general tab, the only field required is Name. This name represents the name YOU want to use to identify this PostgreSQL server in the PgAdmin interface. You could call it monkey if you want - it doesn't require any relation to a name in the real world.
For today's exercise let's name it "Workshop"
In the comment field you can put in some information about this server connection. The information can be brought up in the interface later and can help you remember facts about this server.
Once you are done filling in those fields go ahead and click on the second tab titled Connection.
This Connection tab contains most of the important information about your server.
We just finished the basic skeleton of a function: declaration, function name, parameters, return type, code block, and language used. In our next exercise we will explore doing more with the function declaration and parameters.