-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
31 lines (27 loc) · 1.2 KB
/
schema.sql
File metadata and controls
31 lines (27 loc) · 1.2 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
drop database if exists mydb;
create database mydb;
\c mydb;
create table authors (
id serial primary key,
first_name text,
last_name text
);
insert into authors (first_name, last_name) values ('James', 'S. A. Corey');
insert into authors (first_name, last_name) values ('Craig', 'Alanson');
insert into authors (first_name, last_name) values ('Cixin', 'Liu');
insert into authors (first_name, last_name) values ('David', 'Grann');
create table books (
id serial primary key,
title text,
publishing_year int,
genre_id int
);
insert into books (title, publishing_year) values ('Leviathan Wakes', 2011);
insert into books (title, publishing_year) values ('Caliban’s War', 2012);
insert into books (title, publishing_year) values ('Abaddon’s Gate', 2013);
insert into books (title, publishing_year) values ('Cibola Burn', 2014);
insert into books (title, publishing_year) values ('Nemesis Games', 2015);
insert into books (title, publishing_year) values ('Babylon’s Ashes', 2016);
insert into books (title, publishing_year) values ('Persepolis Rising', 2017);
insert into books (title, publishing_year) values ('Tiamat’s Wrath', 2018);
insert into books (title, publishing_year) values ('Strange Dogs', 2017);