#### **介紹**
PostgreSQL是一個功能強大的開源對象關系數據庫系統,經過30多年的積極開發,在可靠性,功能健壯性和性能方面贏得了良好的聲譽。
#### **命令行**
- 命令行文檔
<https://devdocs.io/postgresql~14/app-psql>
- 快速連接
```bash
psql -h localhost -p 5432 -U postgres -d dbName
```
```bash
psql -h localhost -p 5432 -U postgres -d dbName --no-password
```
- 幫助文檔 `\help`
- 查看所有數據庫 `\l`
- 切換數據庫 `\c db_name`
- 查看所有表和序列 `\d`
- 查看所有表 `\dt`
- 查看表結構 `\d table_name` or `\d+ table_name`
- 展開表格 `\x`
- 退出psql `\q`
#### **速查清單**
```sql
SELECT to_char(now(),'yyyy-MM-dd HH24:MI:ss'); -- 格式化當前時間(2022-07-15 13:17:36)
```