Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #38

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
31 changes: 27 additions & 4 deletions task.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,33 @@ CREATE TABLE Countries (
PRIMARY KEY (ID)
) ENGINE=InnoDB;

-- Create a table for caching GeoIP data (Columns: ID, IP Range, CountryID)
CREATE TABLE GeoIPCache (
ID INT AUTO_INCREMENT,
IPRange VARCHAR(50),
CountryID INT,
PRIMARY KEY (ID),
FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE NO ACTION
) ENGINE=Memory;

-- Create a table for storing product descriptions for different countries (Columns: ID, CountryID, ProductID, Description )
CREATE TABLE ProductDescription (
ID INT AUTO_INCREMENT,
Description VARCHAR(100),
ProductID INT,
CountryID INT,
PRIMARY KEY (ID),
FOREIGN KEY(ProductID) REFERENCES Products(ID) ON DELETE SET NULL,
FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE NO ACTION
) ENGINE=MyISAM ;

-- Create a table for storing logs. For now we don't need to save them, but we need to implement functionality (Columns: ID, Time, LogRecord)
CREATE TABLE Logs (
ID INT AUTO_INCREMENT,
Timestamp TIMESTAMP,
Message VARCHAR(300),
PRIMARY KEY (ID)
) ENGINE=Blackhole;

-- Create a table for storing reporting data, which will be send to a separate application in the CSV format for analytics purposes (Columns: Date, ProductName, Orders)
CREATE TABLE ProductReporting (
Date DATE NOT NULL,
ProductName VARCHAR(50) NOT NULL,
Orders INT NOT NULL
) ENGINE=CSV;
Loading