Postgrel 常見操作(1)

在win下用客戶端,基本上不需要記錄什麼命令了,在linux不一樣做個標記:


顯示所有數據庫:

\l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges   
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     | 
 template0 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 testdb    | postgres | UTF8     | C       | C     | 
選擇數據庫:

postgres=# \c testdb;
psql (9.2.4)
Type "help" for help.
You are now connected to database "testdb" as user "postgres".
testdb=# 

刪除數據庫

DROP DATABASE [ IF EXISTS ] name

Example

Following is a simple example, which will delete testdb from your PostgreSQL schema:

postgres=# DROP DATABASE testdb;
postgres-# 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章