-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.sql
More file actions
35 lines (27 loc) · 1.45 KB
/
data.sql
File metadata and controls
35 lines (27 loc) · 1.45 KB
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
29
30
31
32
33
34
-- Some initial data for the test database.
INSERT INTO author (last_name, first_name, middle_name, year_of_birth)
VALUES ('Sagan', 'Carl', 'Edward', '1934');
INSERT INTO author (last_name, first_name, nationality, year_of_birth)
VALUES ('Odersky', 'Martin', 'DE', '1958');
INSERT INTO author (last_name, first_name) VALUES ('Spoon', 'Lex');
INSERT INTO author (last_name, first_name) VALUES ('Venners', 'Bill');
INSERT INTO book (title)
VALUES ('The Demon-Haunted World: Science as a Candle in the Dark');
INSERT INTO book (title) VALUES ('Cosmos');
INSERT INTO book (title) VALUES ('Programming in Scala');
INSERT INTO bookauthor (book_id, author_id)
SELECT book.id, author.id FROM book, author
WHERE book.title = 'The Demon-Haunted World: Science as a Candle in the Dark'
AND author.last_name = 'Sagan';
INSERT INTO bookauthor (book_id, author_id)
SELECT book.id, author.id FROM book, author
WHERE book.title = 'Cosmos' AND author.last_name = 'Sagan';
INSERT INTO bookauthor (book_id, author_id)
SELECT book.id, author.id FROM book, author
WHERE book.title = 'Programming in Scala' AND author.last_name = 'Odersky';
INSERT INTO bookauthor (book_id, author_id)
SELECT book.id, author.id FROM book, author
WHERE book.title = 'Programming in Scala' AND author.last_name = 'Spoon';
INSERT INTO bookauthor (book_id, author_id)
SELECT book.id, author.id FROM book, author
WHERE book.title = 'Programming in Scala' AND author.last_name = 'Venners';