Skip to content

Instantly share code, notes, and snippets.

@ajkovar
Created July 1, 2020 02:00
Show Gist options
  • Save ajkovar/d079980763b1e66fe9e774a39302779b to your computer and use it in GitHub Desktop.
Save ajkovar/d079980763b1e66fe9e774a39302779b to your computer and use it in GitHub Desktop.
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(200) NOT NULL
);
insert into users (name) values ('bob'), ('tom'), ('jane'), ('mary');
CREATE TABLE sales (
id SERIAL PRIMARY KEY,
user_id int references users(id),
value bigint,
sold_on timestamptz
);
insert into sales
(user_id, value, sold_on)
values
(1, 200, '2020-06-22 19:10:25-07'),
(2, 300, '2020-06-18 19:10:25-07'),
(3, 340, '2020-06-12 14:10:25-07'),
(3, 450, '2020-06-21 9:10:25-07'),
(4, 250, '2020-06-20 19:10:25-07');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment