# PostgreSQL [SQLAlchemy 2.0](/5c86hsQoTLeEluc2YCdBOw) References: https://docs.postgresql.tw/server-administration/installation-from-source-code/short-version Installation --- - Ubuntu -  - other: - https://www.postgresql.org/download/linux/ubuntu/ ``` sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get -y install postgresql ``` - Official: - https://docs.postgresql.tw/server-administration/installation-from-source-code/installation-procedure Cheet Sheet: --- - Docker root: `sudo usermod -aG docker $USER - Docker: - `docker run --name postgres-db -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgres` - `docker exec -it postgres-db bash ` - create new database: `createdb mydb` > if error happen: > - not yet install postgreSQL > - try this `$ /usr/local/pgsql/bin/createdb mydb > - https://docs.postgresql.tw/tutorial/getting-started/creating-a-database - remove database: `dropdb mydb` - enter database: `psql mydb` - single-argument mode: `psql -s mydb` > if show mydb=> means you're normal-user > if show mydb=# means you're super-user - Command: - help: `\h` - quit: `\q` - `\d` show all table name( index ) - Show data`select column_name from table_name where condition_describe` - `where created::text like '2021-03-22%';` SQLAlchemy ``
×
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