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%3Ftable%3Dblock%26id%3D9803ddd7-5b06-472d-8cf5-cd33321a8f5f%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DKwBgZ4CIBMofjqV3oyru9yXhz8hq-c7vXxrM1rNpevI?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%3Ftable%3Dblock%26id%3Dae5d5974-7de5-4509-a42c-1c3f61c45c21%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DUALyKDtKJFnh6n5VMYSuXnkk1nH1enN_aaocMEkXqqU?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%3Ftable%3Dblock%26id%3Df8b16285-eb15-4474-8b72-e875ce21d5b5%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DdpFTkULzdmpGkCVuI-7f5Yw7Igk1BTAyEJSevB5fCqo?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%3Ftable%3Dblock%26id%3Db68bf3a2-ef39-44c3-a916-bbd44dfb5218%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3D-31u9aXihXrSRuewQzDgZFBZIdb5DA354hzrxU5EK4E?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%3Ftable%3Dblock%26id%3D9319e7d0-392f-420d-9d8e-38a4ea022d0f%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3Di5e7PbA8rSXW7ewLLilb7UcHHmhIvSTjzYB38hNQg5E?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%3Ftable%3Dblock%26id%3Db3034415-7d4a-4fa3-8883-6e55510c0e80%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DIJ2itDOl1pGUVHCKbAN19qt-d5IRU5uzE_GrLU-UpgA?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%3Ftable%3Dblock%26id%3De8d43b86-ae45-420e-ad0e-e3497fd9d151%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DL7_oYXBF6YG44wW_Oi-MZ7JjY7vHe5LbGIlOh8kcNA8?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%3Ftable%3Dblock%26id%3D6959c81b-a207-450b-859a-a7d1895b7e6b%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3D34GRhFgnUNLcjIoCm2mSW8RXQNwDFvoB1TJVd2Qx_Wc?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%3Ftable%3Dblock%26id%3D220349e6-960b-4235-9514-3709ed5c026f%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DThancW-WzNnnl1frTFEXokyV7kdvWkx8L40JAkeViNo?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%3Ftable%3Dblock%26id%3Dfb5aaea3-57fa-4cae-9ab1-1a24154c0dbf%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DObdVpbkLcgUwxJyPfY5DdIsmds8pf3ipp3hSzhUtu_A?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%3Ftable%3Dblock%26id%3D1436b421-a59c-4210-840c-c42e0ce3f94b%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DR6HGqEHh6_GMY4ZHORHmu1B4mBz3sFkId8JJaDAU1rw?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%3Ftable%3Dblock%26id%3D4aa0916e-c9e3-4ad5-aac8-ab201ee27d12%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DKY7-2ackFYw0QCdX11Bpr0bXn52uKpzcEPnS9iqm-7I?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%3Ftable%3Dblock%26id%3D8032e1e4-2645-48c1-9af4-3cbc49f682c4%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3Dy0KpYbQd2ytA5Y-W9JU9b3CmqR55M4CiFefvIOAo0Mk?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%3Ftable%3Dblock%26id%3D0811cdbb-13ce-4184-b33c-ce34e00302f8%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DJhGA7YqJ4ESl_t8A3WIdjC64VrUWqHB-g-TF8Hl5wT0?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%3Ftable%3Dblock%26id%3D345e3ba8-39de-4dd8-8488-cebcf9b052ec%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DRROEmMn2CutrkLU4-VmB4fietABtsCsS1qz1r2P8fJI?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%3Ftable%3Dblock%26id%3D77d63273-93d2-4b8a-ac42-5b6d495a85e3%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DoILSUXXzhPb7Ehs2fADv8rZjYzdU6aweRpOiGAGQuUc?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%3Ftable%3Dblock%26id%3D82f1ef98-58bf-4e9f-9a9d-011cdc78917b%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DbVxAmuJUh5rutsdOPeuUJ47RKYHEt0_2m-0iZwkTSMw?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%3Ftable%3Dblock%26id%3De9b305f6-ad5f-4694-a7c0-0eba37b8af23%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DVZRBC0TLiXILjsCGVNLxsV3yHVjv2TTCiLKrdxXiXDg?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%3Ftable%3Dblock%26id%3Daa745b80-e4bf-45a4-918c-164e2664740e%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DEMVNDkDkw5rkMNBeDgeUhbngiZ5bzjaa4Y6tZZ9oCMc?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%3Ftable%3Dblock%26id%3D7d2dd05b-8e3a-4a28-891b-252b5574bf1c%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DDM7vmjM5PYmADXrNbAuHdGei05jIRNw4DdM5BbRnZG4?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%3Ftable%3Dblock%26id%3D5170aca7-85e4-431c-a4f0-7aee6ade2b65%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3DYypZjQRp7VBPnjgYgx9OGjjNdyVbch95okZxh0_ZuS8?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%3Ftable%3Dblock%26id%3D205879df-577c-4c58-87be-f5cb339d1993%26spaceId%3De1c5ba0e-562a-49b0-8505-ce5e38fc061b%26expirationTimestamp%3D1725516000000%26signature%3Diw3UKKnez6kGCLpjoNq_50hwteHwiMhNnDjDDD1AIq8?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