Skip to content

Instantly share code, notes, and snippets.

@jdaarevalo
Created January 30, 2021 11:59
Show Gist options
  • Save jdaarevalo/22037aa3e26fc0e37b910f1f7114d3c1 to your computer and use it in GitHub Desktop.
Save jdaarevalo/22037aa3e26fc0e37b910f1f7114d3c1 to your computer and use it in GitHub Desktop.
sql-create-tables
-- 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