Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions task.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@ CREATE TABLE ProductInventory (
);

-- Populate test data
CREATE TABLE Countries (
ID INT AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(255)
);

CREATE TABLE Products(
ID INT AUTO_INCREMENT PRIMARY KEY,
NAME VARCHAR(255)
);

CREATE TABLE Warehouses(
ID INT AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(255),
Address VARCHAR(255),
CountryID INT,
FOREIGN KEY (CountryID) REFERENCES Countries(ID)
);


CREATE TABLE ProductInventory (
ProductID INT,
WarehouseID INT,
Amount INT,
PRIMARY KEY (ProductID, WarehouseID),
FOREIGN KEY (ProductID) REFERENCES Products(ID),
FOREIGN KEY (WarehouseID) REFERENCES Warehouses(ID)
);
Comment thread
Xandane marked this conversation as resolved.


INSERT INTO Countries (ID,Name)
VALUES (1, 'Country1');
Expand Down
Loading