Javatpoint Logo
Javatpoint Logo

PostgreSQL Select Database

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:

  • We can verify the available database list with the help of the below command:

And the window will look like this:

PostgreSQL Select Database
  • Now, type the below command to select or connect the desired database.
  • Here, we will connect to the 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:
PostgreSQL Select Database

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:
PostgreSQL Select Database

Step 4

  • Now, a new window appears with a connection made to the database we selected, and here we can run SQL queries.
PostgreSQL Select Database




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA