5.8. PostgreSQL Select Database

发布时间 :2025-10-25 12:30:52 UTC      

In the previous section, we talked about how to create a database, and then we discussed how to select the database we created.

5.8.1. The command window of the database

In the PostgreSQL command window, we can enter the SQL statement at the command prompt:

postgres=#

Usel to view existing databases:

postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     |
 runoobdb  | postgres | UTF8     | C       | C     |
 template0 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
(4 rows)

Next we can usec + database name to enter the database:

postgres=# \c runoobdb
You are now connected to database "runoobdb" as user "postgres".
runoobdb=#

5.8.2. System command line window

From the command line of the system, we can add the database name after the connection to the database to select the database:

$ psql -h localhost -p 5432 -U postgres runoobdb
Password for user postgres: ****
psql (11.3)
Type "help" for help.
You are now connected to database "runoobdb" as user "postgres".
runoobdb=#

5.8.3. PgAdmin tool

The pgAdmin tool is easier. Just click on the database to select it. You can also view some additional information about the database:

Image0

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.