I have following tables in my database (this is only a single part).
- C_location table - hold information about locations (about 500 row)
- C_ProjectStatus table - hold information about ProjectStatus (about 5 rows)
- Project table - hold information about projects (about 1 mln rows)
- ProjectLocation - the list of location that the project is implemented (about 10mln rows, each project has about 10 locations)
- ProjectLocationParticipant - hold the information about the Participants in each location (about 5 participant for each location about 50 mln rows).
In general this is not the whole DB, I have also other "one to many" relations for Project, ProjectLocaion, etc. For example each Project has many implementers (ProjectImplementers table with FK to project) and ProjectImplementer can have its own "one to many" relation table with FK to ProjectImplementer table. So I have 3 kind of tables
- Main entity or root - the Project table
- lookup table - C_ProjectStatus and C_Location
- Sub-entity table - All the child tables for project table, like ProjectLocation, ProjectLocationParticipant, etc.
This is my database structure.
CREATE TABLE C_Location (
LocationID INT PRIMARY KEY CLUSTERED IDENTITY,
Name NVARCHAR(50)
)
GO
CREATE TABLE C_ProjectStatus (
ProjectStatusID INT IDENTITY PRIMARY KEY,
Name NVARCHAR(50)
)
CREATE TABLE Project (
ProjectID INT IDENTITY PRIMARY KEY,
Title NVARCHAR(50),
StartDate DATETIME,
ProjectStatusID INT FOREIGN KEY REFERENCES dbo.C_ProjectStatus(ProjectStatusID)
)
GO
CREATE TABLE ProjectLocation (
PojectLocationID INT IDENTITY PRIMARY KEY,
ProjectID INT FOREIGN KEY REFERENCES dbo.Project(ProjectID),
LocationID INT FOREIGN KEY REFERENCES dbo.C_Location(LocationID)
)
GO
CREATE TABLE PorjectLocationParticipant (
ProjectLocationParticipantID INT PRIMARY KEY IDENTITY,
ProjectLocationID INT FOREIGN KEY REFERENCES dbo.ProjectLocation(PojectLocationID),
ParticipantFirstName NVARCHAR(50),
ParticipantLastName NVARCHAR(50)
)
I am very new in data warehouse so I need help to convert this structure to star schema.