- You know that you're in the right database when you see the name of the database at the beginning of the terminal line.
- If you already know the name of the database you want to connect to, you can write psql name_of_database and that would be equivalent to psql postgres \c name_of_database
- Remember to steer clear of double quotes around strings in your queries!
\lList databases\cConnect to a database\dtDisplay Tables in a database\qQuit out of psql to normal terminal
- CREATE
INSERT INTO worlds (name) VALUES ('Asgard'); - READ
SELECT * FROM herbs; - UPDATE
UPDATE herbs SET sighting_date = '2021-01-10' WHERE id='1'; - DELETE
DELETE FROM herbs WHERE id='1';
- BETWEEN
SELECT * FROM trips WHERE start_date BETWEEN '2021-02-01' AND '2021-02-12'; - LIKE
SELECT * FROM books WHERE title LIKE '%ship%';