Business Intelligence Tutorial
You need to define foreign keys for the relationships between the
FACT_TABLE and the other target tables.
In this exercise, you will define a foreign key in the FACT_TABLE
(dependent table) based on the primary key of the LOOKUP_MARKET table (parent
table).
To define the foreign keys:
- Find the FACT_TABLE table in the list of tables for the TUTWHS
database. Right-click the table and click Alter.
The Alter Table notebook opens.
- Click the Foreign Keys tab. The Foreign Key page
opens.
- Click Add. The Add Foreign Key window
opens.
- In the Table schema field, select IWH.
- In the Table name field, specify LOOKUP_MARKET, which is the
parent table. The Primary key field displays the primary key
for LOOKUP_MARKET. The steps that generate the parent table must be in
test or production mode in order for the primary key to be available. A
primary key must be defined for the parent table before a foreign key can be
defined for the FACT_TABLE.
- In the Available columns list, select CITY_ID as the column
that you want defined as the foreign key.
- Click > to move CITY_ID to the Foreign key
list.

- Click OK to save your definitions.
Define foreign keys for the FACT_TABLE to the other target tables by
repeating steps 3 to 8. Define:
- TIME_ID as a foreign key with the LOOKUP_TIME table as the parent.
- PRODUCT_KEY as a foreign key with the LOOKUP_PRODUCT table as the
parent.
- SCENARIO_ID as a foreign key with the LOOKUP_SCENARIO table as the
parent.

- Click OK to save the information in the Alter Table
window.
[ Top of Page | Previous Page | Next Page | Table of Contents ]