SQL view examples
Each SQL view should only retrieve the columns required for the dimension or fact table. If necessary, the views should apply business-friendly, unambiguous column aliases with spaces and proper casing. Dimension table views should include the surrogate key used for the relationship-to-fact tables, as well as the business or natural key column if historical tracking is maintained as will be shown by the customer dimension example later in this section.
Fact table views should include the foreign key columns for the relationships to the dimension tables, the fact columns needed for measures, and a WHERE clause to only retrieve the required rows, such as the prior three years. Given the size of many data warehouse fact tables ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access