Created
January 3, 2022 14:57
-
-
Save patrikbraborec/07d75137f8c6c72b2abc2592f58ce5fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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