Jan
29
2013

Basic PostgreSQL Shell Commands

Create a database: createdb phidatabase

Connect to database: psql phidatabase

  • \l - List databases
  • \d - List tables in database
  • \h - help command
  • \? help on internal lash command
  • \g - execute query
  • \q - quit
Basic SQL Queries:
  • CRAETE TABLE phitable (id int, data varchar(200), datecraeted date);
  • INSERT INTO phitable VALUES ('1', 'somevalue', '9-9-2013');
  • SELECT * FROM phitable;
  • UPDATE phitable SET id=2, data = 'some data' WHERE id = 1;
  • DELETE FROM phitable WHERE = id = 2;
  • DROP TABLE phitable;

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Calendar

<<  October 2020  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar