I have a PostgreSQL database containing various education data such school-level test scores and enrollment figures. I need to separate enrollment from test scores because
The two quickest ways I can think of:
A) You can just left join the fact table into the corresponding tables that they are used in. You will just need to rename the fields to avoid conflicts with the other tables.
B)You can rename the common fields, which can be done by
QUALIFY
(before you load the fact tables) and UNQUALIFY
(after you load the fact tables)Assuming that the fact tables have unique id field names that can be linked to the main tables , you shouldn't have to rename anything in the main tables
I'd go with B-1, since that seems a little less of a hassle.
QUALIFY
A,
B,
C,
ID;
FactTable1:
Load ID,
A,
B,
C,
From [FactTable1];
FactTable2:
Load ID,
A,
B,
C,
From [FactTable2];
UNQUALIFY
A,
B,
C,
ID;
EDIT: If you want to create a link table from these, you can concatenate the fact tables into one table where you put all the columns into it (there will be nulls for a lot of the columns, but QlikView is good with nulls).
What i usually do is load the fact tables in and create an id field (either RowNo() or autonumberhash128([list of unique id fieldnames]), then when i load them into a link table, I include that id field in the link table as well. Finally, i drop the all the common fields from the fact tables, so they only exist in the link table.