type
Post
Created date
Sep 18, 2022 09:01 AM
category
Data Science
tags
Data Warehousing
status
Published
Language
English
From
School
summary
slug
password
Author
Jason Ching Yuen Siu
Priority
Featured
Featured
Cover
Origin
Type
URL
Youtube
Youtube
icon
Temporal data warehousing using bridge table
Summary
A temporal data warehousing uses the concept of the Bridge Table (or a Weak Entity), where the history is maintained in a bridge table.
- Maintaining the history of certain attributes is important in order to make associative analysis more accurate when analysing the reports produced by the fact and dimensions.
- However, certain degree of caution when joining the fact table and the temporal dimension, especially when the level of granularity of time between the fact and the temporal dimension is not the same.
- Temporal data warehousing is also known as Slowly Changing Dimensions(SCD).
- Different types will server different purposes of the data warehousing
Temporal Attributes
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F38ee0f6f-f3dd-4b3e-9293-f14fbbde3cc0%2FUntitled.png%3Fid%3D9803ddd7-5b06-472d-8cf5-cd33321a8f5f%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3D94WFwZGvTVAvgh30a-s0Xop2g-dxbJY0b2CwYpKcC-4?table=block&id=9803ddd7-5b06-472d-8cf5-cd33321a8f5f&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F8a728df8-a85d-42b0-9958-0db4c621a143%2FUntitled.png%3Fid%3Dae5d5974-7de5-4509-a42c-1c3f61c45c21%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DDVsDRgjy3TmqEhcxPTC4nP4c2Mm6rfxdscn_QRarlnE?table=block&id=ae5d5974-7de5-4509-a42c-1c3f61c45c21&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F4e497c0c-4101-4364-b5cc-0f28bb08ccd7%2FUntitled.png%3Fid%3Df8b16285-eb15-4474-8b72-e875ce21d5b5%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DdSxIXlP5M4XUq4IZPQoGvEA0wqCJCZ7id0e_hgqJT28?table=block&id=f8b16285-eb15-4474-8b72-e875ce21d5b5&cache=v2)
Case Study (Lecture): A Bookshop (using bridge table)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F5abb76db-e21d-43f0-86f6-4464f8b9f316%2FUntitled.png%3Fid%3Db68bf3a2-ef39-44c3-a916-bbd44dfb5218%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DgwE2kUifPQW7Z2lQXtHCfY_NLNG2Qvh4NaSTpho2b3o?table=block&id=b68bf3a2-ef39-44c3-a916-bbd44dfb5218&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2Fb3609390-1c70-4543-be9e-a19575680e94%2FUntitled.png%3Fid%3D9319e7d0-392f-420d-9d8e-38a4ea022d0f%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DveMb9kibT05W6CW16hFoSEZ-UFTS7GUuMJQkBH7zIQY?table=block&id=9319e7d0-392f-420d-9d8e-38a4ea022d0f&cache=v2)
Temporal Dimensions
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F4de7181b-eab2-4b78-b60d-e86bc790cecf%2FUntitled.png%3Fid%3Db3034415-7d4a-4fa3-8883-6e55510c0e80%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DS3JVtRwITAfMYdsJ-ILkerEfkuYot-8oAk2NBwHqCuE?table=block&id=b3034415-7d4a-4fa3-8883-6e55510c0e80&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2Fb16f9fc5-8502-4835-bb03-00e445b45b3d%2FUntitled.png%3Fid%3De8d43b86-ae45-420e-ad0e-e3497fd9d151%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DYf25MdtQsnxDs-f7T6qNv-r_amNDKvAayqEFloNlVzo?table=block&id=e8d43b86-ae45-420e-ad0e-e3497fd9d151&cache=v2)
Slowly Changing Dimensions (SCD)
Summary (SCD)
Tables
![We’ve summarized the techniques for tracking dimension attribute changes in Figure 5-17. This chart highlights the implications of each slowly changing dimension technique on the analysis of performance metrics in the fact table. ( The Data Warehouse Toolkit )](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2Ff0ecc3cc-6cfb-4df9-a546-0e13d480f7d5%2FUntitled.webp%3Fid%3D6959c81b-a207-450b-859a-a7d1895b7e6b%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DCRzzHG1UwoEGqKkfRo9o6P_VM5HRDihJL96IKqozH3Q?table=block&id=6959c81b-a207-450b-859a-a7d1895b7e6b&cache=v2)
![(Here)](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F251f6891-c66c-4561-91e6-f9ec3a824502%2FUntitled.png%3Fid%3D220349e6-960b-4235-9514-3709ed5c026f%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3D96cnVJ-CQxEDJBJQWEfB6L1Div0nQE6BlI8iRZc8pjo?table=block&id=220349e6-960b-4235-9514-3709ed5c026f&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F8eee5052-6a6f-46c9-bc9b-aab0d0c03b87%2FTemporal_dim_flowchart_2.png%3Fid%3Dfb5aaea3-57fa-4cae-9ab1-1a24154c0dbf%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3D0gI6XPn50tJVDzH2-xLmes-uwpmXwqKDXpayPXD8wTI?table=block&id=fb5aaea3-57fa-4cae-9ab1-1a24154c0dbf&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F64e80328-6551-4e82-bd00-ea6838de8ef5%2FUntitled.png%3Fid%3D1436b421-a59c-4210-840c-c42e0ce3f94b%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DmPu0cAXUypXDXisekfd2CYG5JL_RlgYc6ljA2T9HiUU?table=block&id=1436b421-a59c-4210-840c-c42e0ce3f94b&cache=v2)
Slowly Changing Dimensions (SCD)
SCD includes 6 types (i.e., Type 0, 1, 2, 3, 4, 6).
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2Ff877d43b-c936-4b38-8b8d-44d6fc413f5d%2FUntitled.png%3Fid%3D4aa0916e-c9e3-4ad5-aac8-ab201ee27d12%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DmS7lbwk1l_xdlFZ-okVSL0UqglPK2t8NknOlTUi8gAA?table=block&id=4aa0916e-c9e3-4ad5-aac8-ab201ee27d12&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2Fccad5bfa-d36a-47d3-be04-05c4a0603cc8%2FUntitled.png%3Fid%3D8032e1e4-2645-48c1-9af4-3cbc49f682c4%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DAvTTjsBR-18-ZesXXUFZQpusYVRkFT2od3afShwaiXQ?table=block&id=8032e1e4-2645-48c1-9af4-3cbc49f682c4&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F4cfb34cd-1f44-4ba2-84f9-7349ba3d81e1%2FUntitled.png%3Fid%3D0811cdbb-13ce-4184-b33c-ce34e00302f8%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3Dj7XZFKJUxkwoCOLcGjEYP10he4U1WEr-G6BfhAl2s8g?table=block&id=0811cdbb-13ce-4184-b33c-ce34e00302f8&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F49cf8978-925f-43fa-b421-3b8c667b3579%2FUntitled.png%3Fid%3D345e3ba8-39de-4dd8-8488-cebcf9b052ec%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3Df9ycbdVvGC3mw3ejzIjFXLKJxy6EUaVOsOPpsl_x81I?table=block&id=345e3ba8-39de-4dd8-8488-cebcf9b052ec&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F43c1a505-8687-434a-814a-f8bbb6ee1236%2FUntitled.png%3Fid%3D77d63273-93d2-4b8a-ac42-5b6d495a85e3%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3Dsxpc_OYJh1QItQQ3_RSf5ImYtx_zKY55SOGaiQ3XYm0?table=block&id=77d63273-93d2-4b8a-ac42-5b6d495a85e3&cache=v2)
Implementation of SCD in SQL
Creating Fact Tables
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F3269de51-9125-4bc4-ab49-df7b01978153%2FUntitled.png%3Fid%3D82f1ef98-58bf-4e9f-9a9d-011cdc78917b%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DzNlwZIfckMpJjWDytz1w4_0iwNl9AiG3uCaJhrqXYco?table=block&id=82f1ef98-58bf-4e9f-9a9d-011cdc78917b&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F42e4c7ae-989a-4b40-8f36-7b83b32db106%2FUntitled.png%3Fid%3De9b305f6-ad5f-4694-a7c0-0eba37b8af23%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3Dyp_vAeJi7mmyraOtk8_k8DNpySX0EjNajp4MGXrCZf8?table=block&id=e9b305f6-ad5f-4694-a7c0-0eba37b8af23&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2Ff398feca-4a81-457c-af8b-495bee7ea2f6%2FUntitled.png%3Fid%3Daa745b80-e4bf-45a4-918c-164e2664740e%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DPyvWlAJYmBPXVvvzYn7EghsIdoUyj2aTOWesqewJ-nM?table=block&id=aa745b80-e4bf-45a4-918c-164e2664740e&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2Fdad024aa-83f7-4001-b718-0b66b1e3f1c7%2FUntitled.png%3Fid%3D7d2dd05b-8e3a-4a28-891b-252b5574bf1c%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DlZTiSVNh6AJq_-KQgVqU4IyP1da6YbPXiF9aAVU8fDk?table=block&id=7d2dd05b-8e3a-4a28-891b-252b5574bf1c&cache=v2)
Other Case Studies
Case Study (Lab): A Bookshop
Case study (Lecture Activity): Sessional Jobs Case Study
Monash University employs its students to do various jobs, such as tutoring, programming, etc. These jobs are called sessional jobs. For each sessional job, students need to sign a contract. For example, to do tutoring (one or more units), the student will sign a contract with Monash for one semester.
These sessional workers (e.g. sessional tutors) need to claim their work hours every week. This claim will need to be approved by a designated person in the faculty. Every fortnight, the sessional workers will get their pay.
The operational database, which keeps track of this system, is shown by the following E/R diagram
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F4198c23e-c665-4996-b460-d385d462f734%2FUntitled.png%3Fid%3D5170aca7-85e4-431c-a4f0-7aee6ade2b65%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3DSWVC5wG3dzGqivnn3PsxnA3VSsgjcTcT7wXGdw1DagE?table=block&id=5170aca7-85e4-431c-a4f0-7aee6ade2b65&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fe1c5ba0e-562a-49b0-8505-ce5e38fc061b%2F61534540-9433-48af-98e4-7cf57883c2c4%2FUntitled.png%3Fid%3D205879df-577c-4c58-87be-f5cb339d1993%26table%3Dblock%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1721822400000%26signature%3D4aTPt7yryCu3L0PJmPxGKcp1wmF5Tmk5n7xyzm_ZZNo?table=block&id=205879df-577c-4c58-87be-f5cb339d1993&cache=v2)
- Author:Jason Siu
- URL:https://jason-siu.com/article%2F15740c8e-2f56-4d83-9eb1-ac36aeaec63f
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts
FIT3003 - W8 - CUBE & ROLLUP in SQL (With partial CUBE and partial ROLLUP) (W8)
FIT3003 - W7 - Determinant dimensions
FIT3003 - W8 - SQL Notes about Cumulative and Moving Aggregates
FIT3003 - W8 - SQL Notes about RANK() OVER (PARTITION BY x ORDER BY y)
FIT3003 - Unique SQL functions in Oracle Database
FIT3003 - W11 - Active Data Warehousing