# PostgreSQL ###### tags: `database` `posthreSQL` ## 安裝 mac使用homebrew安裝 ```bash= $ brew install postgresql ``` 安裝完後啟動方法 ```bash= $ brew services start postgresql ``` 另外可能會有一些local的設定問題 去改 pg_hba.conf METHOD部分全部改成trust  ## 啟動 首先需要先創造DB ```bash= $ createdb <your db name> ``` 創造完後就可以進入操作 ```bash= $ psql -U <your db name> ``` 接下來會進入你的DB內,就可以直接開始操作DB了 ``` <your db name>=$ ``` ## 語法 ### 創造table ``` > CREATE TABLE <table name> ``` ### 刪除table ``` > DROP TABLE <table name> ``` ### 查詢table ``` > SELECT * FROM <table name> ``` [練習的網站](https://www.codecademy.com/learn/learn-sql)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up