Postgres: Difference between revisions
| Line 6: | Line 6: | ||
\d <TABLE> // show schema of table | \d <TABLE> // show schema of table | ||
\dt // show tables | \dt // show tables | ||
<SQL>; | <SQL>; // e.g. | ||
CREATE DATABASE "<DB>"; // !!! SQL case sensitive, DB to be enclosed in " otherwise no case sensitiveness, semicolon needed | |||
DROP TABLE <TABLE>; | |||
dropdb -h <HOSTNAME> -U <User> <DB> | dropdb -h <HOSTNAME> -U <User> <DB> | ||
createdb -h <HOSTNAME> -U <User> <DB> | createdb -h <HOSTNAME> -U <User> <DB> | ||
==Installation== | ==Installation== | ||
* [[EDTLaptop1#Postgres|EDT Windows HP Elitebook]] | * [[EDTLaptop1#Postgres|EDT Windows HP Elitebook]] | ||
Revision as of 11:39, 7 October 2021
Operation
psql -h <HOSTNAME> -U <USER> [<DB>]
psql <DB> <USER>
\l // show databases
\c <DB> // connect to DB
\d <TABLE> // show schema of table
\dt // show tables
<SQL>; // e.g.
CREATE DATABASE "<DB>"; // !!! SQL case sensitive, DB to be enclosed in " otherwise no case sensitiveness, semicolon needed
DROP TABLE
; dropdb -h <HOSTNAME> -U <User> <DB> createdb -h <HOSTNAME> -U <User> <DB>