Jan
29
2013
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;