Skip to content

Instantly share code, notes, and snippets.

@jessicard
Created October 3, 2012 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessicard/3829118 to your computer and use it in GitHub Desktop.
Save jessicard/3829118 to your computer and use it in GitHub Desktop.
SQL for beginners 1
CREATE DATABASE contacts;
\connect contacts
CREATE TABLE friends(firstname TEXT, lastname TEXT phone TEXT);
DROP DATABASE contacts;
DELETE FROM friends WHERE firstname = 'david';
INSERT INTO friends(firstname, lastname, phone) VALUES ('david', 'aragon', '1234567890');
SELECT * FROM friends;
psql -h localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment