Skip to content

Commit

Permalink
added a fix based on the AI recommendation
Browse files Browse the repository at this point in the history
  • Loading branch information
fredisson11 committed Dec 10, 2024
1 parent ae20da4 commit 412887b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions task.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@ CREATE DATABASE ShopDB;
USE ShopDB;

CREATE TABLE Countries (
ID INT,
ID INT AUTO_INCREMENT,
Name VARCHAR(50),

PRIMARY KEY (ID)
);

CREATE TABLE Warehouses (
ID INT,
ID INT AUTO_INCREMENT,
Name VARCHAR(50),
Address VARCHAR(50),
CountryID INT,

PRIMARY KEY (ID),
FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE NO ACTION
FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE CASCADE
);

CREATE TABLE Products (
ID INT,
ID INT AUTO_INCREMENT,
Name VARCHAR(50),

PRIMARY KEY (ID)
);

CREATE TABLE ProductInventory (
ID INT,
ID INT AUTO_INCREMENT,
ProductID INT,
Amount INT,
WarehouseID INT,

PRIMARY KEY (ID),
FOREIGN KEY (ProductID) REFERENCES Products(ID) ON DELETE NO ACTION,
FOREIGN KEY (WarehouseID) REFERENCES Warehouses(ID) ON DELETE NO ACTION
FOREIGN KEY (ProductID) REFERENCES Products(ID) ON DELETE CASCADE,
FOREIGN KEY (WarehouseID) REFERENCES Warehouses(ID) ON DELETE CASCADE
);

INSERT INTO Countries (ID, Name)
Expand Down

0 comments on commit 412887b

Please sign in to comment.