I will call you back again to another lecture in PostgreSQL, and in this video lecture I will go ahead
and teach you how to connect to PostgreSQL database.
So in the previous lecture we are able to actually install our database and we go to apps and move down
here.
You can go over to displays and you can see PostgreSQL.
And I'm using Windows 11.
So I didn't go.
If you're using Windows 10 or below, you can go ahead and check out our desktop menu.
And you're going to see PostgreSQL 17.
So go ahead and open up this.
And right in here we have the Pgadmin four.
And we have the SQL shell.
So in PostgreSQL most of the things that we use and is mostly the SQL.
So the SQL shell is what we actually use.
That is the SQL.
That is what we're going to be using here.
So it can actually go ahead and double click on this and that will come up.
So I double click on that twice.
And I can also go over and also check out for the graphical interface.
Go ahead and move down here.
And then go ahead and click on Pgadmin four.
So I'm going to open both of them.
And then I'll go ahead and show you how to connect to your database using both of the applications.
So mainly in this course I will be using the SQL because that is what I'm going to be using here.
And you can also go ahead and check out on the Pgadmin.
And that is coming up.
So this is our Pgadmin is coming up.
So when it comes on I'll go ahead.
And this data now for the SQL.
Let's go ahead and look at this.
So if this console you're going to see localhost.
And because you're working on a computer because we downloaded this and now we are not actually going
to use the remote server.
So if you have a remote server you can actually put that right in here.
But because you can see look I'll go ahead and hit on enter.
And now you're going to choose the database you're going to use.
And during the time of installation it actually installs a default database.
And that default database is PostgreSQL database.
And you're going to go ahead and leave it the way it is for now and go ahead and hit on part.
And then if you hit enter you move over to port.
And then the port we're using is a default port 543, two.
And then go ahead and hit enter.
And it says the username.
So we're still going to leave that and hit enter.
And it's going to ask for your password.
So this is the password you created at the time of installation.
And the password I created is simple.
Just 1234.
And that is my password.
And it cannot see the password shown.
But go ahead and hit on enter and it says SQL 17 and I say 17 console code based on windows code page.
And now over here you can actually start off and move on.
Right now we've connected to PostgreSQL database.
All right.
Now let me go ahead and see okay.
You might be like how that we are not actually connected to this database.
If I go ahead and close this and this is my pgadmin open, I'm going to leave that for now.
I'll go back right in here and I'm going to open this again, and I'm going to move over to the PostgreSQL
17.
And I'm going to hit on the SQL show.
And that is it.
Now if I should go ahead and go over to database and I name this database anything, let's say new data
base.
Let me say maybe you think we don't have a database.
We have a database.
All right.
So if I go ahead and say any database or I'm going to say my database a resume, you can give a name.
So this is just for a test to show that this database will not work because you don't have a database
called my database.
What you have is database is PostgreSQL.
So if I go ahead and hit on this and go ahead and hit on this and enter this and say one, two, three,
four and hit on these, it says error connection.
The server at localhost port failed.
My database does not exist.
You see that my database does not exist.
So whenever we are entering you know that a database PostgreSQL actually exists.
That was why it actually connected to our very first trial.
So close this and open that.
Again, the reason why I'm making this is to let you know that we have a database already today.
Now let's go ahead and go back here and hit on SQL again.
And now go ahead and hit enter.
And then you insert your password.
If you want to insert the password you can see we have error no password supplied.
So I'm saying all this because if you have a mistake or you run into any problem, you can know that
these problems are shown.
Now go ahead and close this again.
And then we go over here.
And now try to open it for the last time so we can move it to.
No worries.
Then why I was able to actually draw these things is to help us to actually get these things done and
running.
Now I'll go enter enter enter enter in the password 123, four and then enter.
And you can see that is now connected.
And I can start writing my query.
Now this is the pgadmin that we're going to use for this.
So the Pgadmin is a graphical interface where you can be able to write your code, and everything is
going to work out fine.
Your query is actually written here.
So this is what you use to write your query.
Now if I go ahead and open up this, you can see I have a PostgreSQL 17.
I'll go ahead and close this.
So this is our PostgreSQL 17.
We'll actually open.
That is because I do click on this and it opened up that.
So if I now click on that again go ahead and click on that.
And it says please enter password for user Postgres Postgres to connect server PostgreSQL 17.
Now if I should go ahead and enter the password now during the installation of this one two, three,
four and that is my password and I can actually save this password.
And I go here and I hit on okay.
And now you can see that PostgreSQL 17 is opened.
And the overlay I will go over to database and open the database.
And I have a database.
Two I can actually remove this because this is a database I have created some time ago.
I'll go ahead and actually remove that.
But what I want to show is I have a database, Postgres.
And this Postgres is what we have right in here.
All right.
And uh, for the course we are dealing with, uh, Postgres.
Okay.
When are we looking at, uh, because you don't have this.
So I have been working, um, over the years, and I have a database I don't want to put down, and
that is why I'm writing here.
But on that you're going to see just one.
And that is the Postgres.
And that is what we're going to see right in here.
And if you go down to schema and you can see we don't have anything, and if you go to your tables and
you're going to see that your table is still empty, all right, because you have not created that.
But uh, if you go to something like Noah is a database we have some time ago.
And, um, if I go to schema and I moved down to my tables and then under here, I have a table called
students.
All right.
So you want to learn how to create all these step by step.
So it's going to be interesting.
It's going to be fun.
Just go ahead and relax and let's go over and start off immediately.
So I'm going to say if you have any question on that is please use the question and answer section.
Otherwise we'll move over to the next video lecture and uh kick off immediately.
Thank you and see you in the next video lecture.