PostgreSQL 選擇數(shù)據(jù)庫

上一章節(jié)我們講了如何創(chuàng)建數(shù)據(jù)庫,接下來我們來討論如何去選擇我們創(chuàng)建的數(shù)據(jù)庫。

數(shù)據(jù)庫的命令窗口

PostgreSQL 命令窗口中,我們可以命令提示符后面輸入 SQL 語句:

postgres=#

使用  \l 用于查看已經(jīng)存在的數(shù)據(jù)庫:

postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges   
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     | 
 nhooodb  | 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)

接下來我們可以使用 \c + 數(shù)據(jù)庫名 來進入數(shù)據(jù)庫:

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

系統(tǒng)命令行窗口

在系統(tǒng)的命令行查看,我么可以在連接數(shù)據(jù)庫后面添加數(shù)據(jù)庫名來選擇數(shù)據(jù)庫:

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

pgAdmin 工具

pgAdmin 工具更簡單了,直接點擊數(shù)據(jù)庫選擇就好了,還可以查看一些數(shù)據(jù)庫額外的信息:

圖片.png
丰满人妻一级特黄a大片,午夜无码免费福利一级,欧美亚洲精品在线,国产婷婷成人久久Av免费高清