In this section, we are going to discuss how we can access or select the database in PostgreSQL.
In our previous section of the PostgreSQL tutorial, we have already created a database.
And, now we are going to select the database with the help of various methods.
In PostgreSQL, we have two methods to select the database:
- Select database using pgAdmin
- Database SQL Prompt
Database SQL Prompt
Suppose we have already launched our PostgreSQL client and we have landed at the following SQL prompt:
postgres=#
- We can verify the available database list with the help of the below command:
\l
And the window will look like this:

- Now, type the below command to select or connect the desired database.
postgres-# \c javatpoint
- Here, we will connect to the javatpoint
You are now connected to database "javatpoint" as user "postgres".
javatpoint-#
Select database using pgAdmin
With the help of pgAdmin, we can also select the database. Follow the below steps for accessing the database in PostgreSQL:
Step 1
- Firstly, we will open the pgAdmin UI and SQL Query window.
Step 2
- Then we will select the database by clicking on it as shown in the below screenshot:

Step 3
- After that, we will click on the Toolsdrop-down menu, and click on Query Tool as we can see in the below image:

Step 4
- Now, a new window appears with a connection made to the database we selected, and here we can run SQL queries.

Leave a Reply