Created
January 30, 2021 11:59
-
-
Save jdaarevalo/22037aa3e26fc0e37b910f1f7114d3c1 to your computer and use it in GitHub Desktop.
sql-create-tables
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
-- Creation of product table | |
CREATE TABLE IF NOT EXISTS product ( | |
product_id INT NOT NULL, | |
name varchar(250) NOT NULL, | |
PRIMARY KEY (product_id) | |
); | |
... | |
... | |
-- Creation of order_status table | |
CREATE TABLE IF NOT EXISTS order_status ( | |
order_status_id varchar(200) NOT NULL, | |
update_at TIMESTAMP, | |
sale_id varchar(200) NOT NULL, | |
status_name_id INT NOT NULL, | |
PRIMARY KEY (order_status_id), | |
CONSTRAINT fk_sale | |
FOREIGN KEY(sale_id) | |
REFERENCES sale(sale_id), | |
CONSTRAINT fk_status_name | |
FOREIGN KEY(status_name_id) | |
REFERENCES status_name(status_name_id) | |
); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment