Skip to content

Instantly share code, notes, and snippets.

@sujyrokimora
Created October 28, 2024 12:17
Show Gist options
  • Select an option

  • Save sujyrokimora/21f2f3df9a40b9960a0b198109a1b58f to your computer and use it in GitHub Desktop.

Select an option

Save sujyrokimora/21f2f3df9a40b9960a0b198109a1b58f to your computer and use it in GitHub Desktop.
CREATE TABLE DimPeriod (
ID_Period INT PRIMARY KEY,
Year_P INT NOT NULL,
Month_P INT NOT NULL,
Day_P INT NOT NULL,
Trimester INT NOT NULL
);
CREATE TABLE DimAnimal (
ID_Animal INT PRIMARY KEY,
Animal_Type VARCHAR(50) NOT NULL,
Breed VARCHAR(50) NOT NULL,
Age INT NOT NULL,
Weigth DECIMAL(10, 2) NOT NULL,
Gender VARCHAR(10) NOT NULL
);
CREATE TABLE DimAuction (
ID_Auction INT PRIMARY KEY,
ID_Period INT NOT NULL,
Date_Auction DATE NOT NULL,
Location_Auction VARCHAR(100) NOT NULL,
Num_Animals INT NOT NULL,
FOREIGN KEY (ID_Period) REFERENCES DimPeriod(ID_Period)
);
CREATE TABLE FactSales (
ID_Sale INT PRIMARY KEY,
ID_Auction INT NOT NULL,
ID_Animal INT NOT NULL,
Quantity INT NOT NULL,
Val_Total DECIMAL(18, 2) NOT NULL,
FOREIGN KEY (ID_Auction) REFERENCES DimAuction(ID_Auction),
FOREIGN KEY (ID_Animal) REFERENCES DimAnimal(ID_Animal)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment