Skip to content

Instantly share code, notes, and snippets.

@mdewey
Created September 12, 2018 18:45
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 mdewey/e5531a01ed98c29cc2ae270baf89edca to your computer and use it in GitHub Desktop.
Save mdewey/e5531a01ed98c29cc2ae270baf89edca to your computer and use it in GitHub Desktop.
CREATE TABLE books (
id SERIAL PRIMARY KEY,
title VARCHAR(100) NOT NULL,
primary_author VARCHAR(100) NULL
);
SELECT * FROM books WHERE title = 'goosebumps'
INSERT INTO books(title, author) VALUES
('goosebumps', 'R. L. Stine');
INSERT INTO books(title, primary_author) VALUES
('animorphs', 'K. A. applegate');
INSERT INTO books(title, primary_author) VALUES
('baby sitters club', 'Anne Martin');
UPDATE books SET title = 'Animorphs' WHERE id = 2;
ALTER TABLE books ADD COLUMN RATING INT NULL
UPDATE books SET rating = 3;
INSERT INTO books (title, primary_author, rating)
VALUES ('Harry Potter', 'JK Rowling', 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment