Skip to content

Instantly share code, notes, and snippets.

@patrikbraborec
Created January 3, 2022 14:57
Show Gist options
  • Save patrikbraborec/07d75137f8c6c72b2abc2592f58ce5fd to your computer and use it in GitHub Desktop.
Save patrikbraborec/07d75137f8c6c72b2abc2592f58ce5fd to your computer and use it in GitHub Desktop.
create table users
(
id serial not null,
first_name varchar,
last_name varchar,
city varchar,
age numeric,
gender varchar,
primary key (id)
);
create table products
(
id serial not null,
name varchar,
type varchar,
price decimal,
cost decimal,
primary key (id)
);
create table orders
(
id serial not null,
user_id integer not null,
status varchar,
created_at date,
solved_at date,
primary key (id),
foreign key (user_id) references users (id)
);
create table order_items
(
id serial not null,
order_id integer not null,
product_id integer not null,
quantity numeric,
foreign key (order_id) references orders (id),
foreign key (product_id) references products (id)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment