Skip to content

Instantly share code, notes, and snippets.

@BenjaminVerble
Last active March 31, 2017 16:28
Show Gist options
  • Save BenjaminVerble/4f9cd35b158cab1eaba76a0cb4f25b94 to your computer and use it in GitHub Desktop.
Save BenjaminVerble/4f9cd35b158cab1eaba76a0cb4f25b94 to your computer and use it in GitHub Desktop.
CREATE TABLE books
(author_id varchar(55) PRIMARY KEY, title varchar(55))
;
INSERT INTO books
('author_id', 'title')
VALUES
('1asdfasdfasdfasdas', 'How to make your life better'),
('asdfasdf23423456gf', 'How to Cook'),
('2134dfg45675fa4352', 'Hi, what is your name, I am joe')
;
CREATE TABLE authors
(id varchar(55), author varchar(55));
INSERT INTO authors
('id', 'author')
VALUES
('1asdfasdfasdfasdas', 'John Smith'),
('asdfasdf23423456gf', 'Jane Smith'),
('2134dfg45675fa4352', 'Joe Sixpack')
;
UPDATE authors SET author = 'Fran Sixpack' where id = '2134dfg45675fa4352';
SELECT
authors.id, books.title, authors.author
FROM
books
JOIN authors ON
books.author_id == authors.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment