I'm trying to build a Star Schema in MySQL. I have the raw data, and I've uild the Dimension Tales and Fact Table. But it looks like my Fact Table is linking correctly to the Dimension Table, because all the Foreign Key values are NULL.
How do I get my fact.producerFK
column to show the foreign key values, instead of NULL?
I've built the Dimension Table....
create table producer (
ProducerKey int not null auto_increment primary Key,
ProducerName text);
I populated it with distinct values....
Insert into producer (ProducerName)
Select distinct Producer from tracker;
and created the Fact Table, with a foreign key referencing the producer table....
create table fact (
FactID int not null auto_increment Primary Key,
Total_Commission int not null,
ProducerFK int,
foreign Key(ProducerFK) references Producer(producerkey)
);
I populated the fact table....
insert into fact (Total_Commission)
select `Total Commission` from tracker
;
I was expecting to see the fact.producerFK
column to show the foreign key values instead of NULL. How do I fix this?