-
Notifications
You must be signed in to change notification settings - Fork 0
/
Challenge: Dynamic Documents
28 lines (22 loc) · 1.1 KB
/
Challenge: Dynamic Documents
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CREATE table documents (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT,
content TEXT,
author TEXT);
INSERT INTO documents (author, title, content)
VALUES ("Puff T.M. Dragon", "Fancy Stuff", "Ceiling wax, dragon wings, etc.");
INSERT INTO documents (author, title, content)
VALUES ("Puff T.M. Dragon", "Living Things", "They're located in the left ear, you know.");
INSERT INTO documents (author, title, content)
VALUES ("Jackie Paper", "Pirate Recipes", "Cherry pie, apple pie, blueberry pie.");
INSERT INTO documents (author, title, content)
VALUES ("Jackie Paper", "Boat Supplies", "Rudder - guitar. Main mast - bed post.");
INSERT INTO documents (author, title, content)
VALUES ("Jackie Paper", "Things I'm Afraid Of", "Talking to my parents, the sea, giant pirates, heights.");
SELECT * FROM documents;
/* update to change the author to jackie draper */
UPDATE documents SET content = "Jackie Draper" WHERE author = "Jackie Paper";
SELECT * FROM documents;
/* delete the row where title is "Things I'm afraid of" */
DELETE FROM documents WHERE id = 5;
SELECT * FROM documents;