Snake case table names
This commit is contained in:
parent
e6560653d9
commit
87ba5bb679
1 changed files with 60 additions and 60 deletions
|
@ -1,88 +1,88 @@
|
|||
CREATE TABLE IF NOT EXISTS Customers (
|
||||
CustomerID int PRIMARY KEY,
|
||||
Name varchar(100),
|
||||
Address varchar(255)
|
||||
CREATE TABLE IF NOT EXISTS customers (
|
||||
customer_id int PRIMARY KEY,
|
||||
name varchar(100),
|
||||
address varchar(255)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS Products (
|
||||
ProductID int PRIMARY KEY,
|
||||
Name varchar(100)
|
||||
CREATE TABLE IF NOT EXISTS products (
|
||||
product_id int PRIMARY KEY,
|
||||
name varchar(100)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS Recipes (
|
||||
RecipeName varchat(100),
|
||||
RecipeYear Year,
|
||||
ingrediences int,
|
||||
ProductID int,
|
||||
PRIMARY KEY (RecipeName, RecipeYear),
|
||||
FOREIGN KEY (ingrediences) REFERENCES ingredience(IngredienceID),
|
||||
FOREIGN KEY (ProductID) REFERENCES Products(ProductID)
|
||||
CREATE TABLE IF NOT EXISTS recipes (
|
||||
recipe_name varchar(100),
|
||||
recipe_year year,
|
||||
ingredients int,
|
||||
product_id int,
|
||||
PRIMARY KEY (recipe_name, recipe_year),
|
||||
FOREIGN KEY (ingredients) REFERENCES ingredients(ingredient_id),
|
||||
FOREIGN KEY (product_id) REFERENCES products(product_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ingredience (
|
||||
IngredienceID int PRIMARY KEY,
|
||||
RawMaterialName varchar(100),
|
||||
CREATE TABLE IF NOT EXISTS ingredients (
|
||||
ingredient_id int PRIMARY KEY,
|
||||
raw_material_name varchar(100),
|
||||
amount int,
|
||||
unit varchar(50),
|
||||
FOREIGN KEY (RawMaterialName) REFERENCES RawMaterials(RawMaterialName)
|
||||
FOREIGN KEY (raw_material_name) REFERENCES raw_materials(raw_material_name)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS RawMaterials (
|
||||
RawMaterialName varchar(100) PRIMARY KEY,
|
||||
Quantity int,
|
||||
LastDeliveryDateTime datetime
|
||||
CREATE TABLE IF NOT EXISTS raw_materials (
|
||||
raw_material_name varchar(100) PRIMARY KEY,
|
||||
quantity int,
|
||||
last_delivery_date_time datetime
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS PalletsProduced (
|
||||
PalletID int PRIMARY KEY,
|
||||
ProductID int,
|
||||
ProductionDateTime datetime,
|
||||
FOREIGN KEY (ProductID) REFERENCES Products (ProductID)
|
||||
CREATE TABLE IF NOT EXISTS pallets_produced (
|
||||
pallet_id int PRIMARY KEY,
|
||||
product_id int,
|
||||
production_date_time datetime,
|
||||
FOREIGN KEY (product_id) REFERENCES products (product_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS PalletsDelivered (
|
||||
DeliveredID int PRIMARY KEY,
|
||||
PalletID int,
|
||||
DeliveryDateTime datetime,
|
||||
FOREIGN KEY (PalletID) REFERENCES PalletsProduced (PalletID),
|
||||
FOREIGN KEY (DeliveredID) REFERENCES Truck (Pallet)
|
||||
CREATE TABLE IF NOT EXISTS pallets_delivered (
|
||||
delivered_id int PRIMARY KEY,
|
||||
pallet_id int,
|
||||
delivery_date_time datetime,
|
||||
FOREIGN KEY (pallet_id) REFERENCES pallets_produced (pallet_id),
|
||||
FOREIGN KEY (delivered_id) REFERENCES truck (pallet)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS Truck (
|
||||
truckId int PRIMARY KEY,
|
||||
CREATE TABLE IF NOT EXISTS truck (
|
||||
truck_id int PRIMARY KEY,
|
||||
capacity int,
|
||||
Pallet int
|
||||
pallet int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS loadingBill (
|
||||
LoadingbillID int PRIMARY KEY,
|
||||
adress varchar(100),
|
||||
CREATE TABLE IF NOT EXISTS loading_bill (
|
||||
loadingbill_id int PRIMARY KEY,
|
||||
address varchar(100),
|
||||
customer varchar(100),
|
||||
truckID int,
|
||||
FOREIGN KEY (truckID) REFERENCES Truck (truckId)
|
||||
truck_id int,
|
||||
FOREIGN KEY (truck_id) REFERENCES truck (truck_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS Orders (
|
||||
OrderID int PRIMARY KEY,
|
||||
CustomerID int,
|
||||
ProductID int,
|
||||
Quantity int,
|
||||
OrderDateTime datetime,
|
||||
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID),
|
||||
FOREIGN KEY (ProductID) REFERENCES Products (ProductID)
|
||||
CREATE TABLE IF NOT EXISTS orders (
|
||||
order_id int PRIMARY KEY,
|
||||
customer_id int,
|
||||
product_id int,
|
||||
quantity int,
|
||||
order_date_time datetime,
|
||||
FOREIGN KEY (customer_id) REFERENCES customers (customer_id),
|
||||
FOREIGN KEY (product_id) REFERENCES products (product_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS BlockedProducts (
|
||||
BlockedProductID int PRIMARY KEY,
|
||||
ProductID int,
|
||||
BlockedDateTime datetime,
|
||||
FOREIGN KEY (ProductID) REFERENCES Products (ProductID)
|
||||
CREATE TABLE IF NOT EXISTS blocked_products (
|
||||
blocked_product_id int PRIMARY KEY,
|
||||
product_id int,
|
||||
blocked_date_time datetime,
|
||||
FOREIGN KEY (product_id) REFERENCES products (product_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS PalletTraceability (
|
||||
TraceID int PRIMARY KEY,
|
||||
CREATE TABLE IF NOT EXISTS pallet_traceability (
|
||||
trace_id int PRIMARY KEY,
|
||||
location varchar(100),
|
||||
locationdate datetime,
|
||||
PalletID int,
|
||||
FOREIGN KEY (PalletID) REFERENCES PalletsProduced (PalletID)
|
||||
location_date datetime,
|
||||
pallet_id int,
|
||||
FOREIGN KEY (pallet_id) REFERENCES pallets_produced (pallet_id)
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue