Facts and Dimensions Table

<p class="MsoNormal" style="line-height:150%">&nbsp;</p><p class="MsoListParagraph" style="text-indent:-.25in;line-height:150%; mso-list:l6 level1 lfo6">-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Difference between Facts and Dimensions Table <b></b></p><p class="MsoNormal" style="line-height:150%"><b>What is a Fact Table? </b></p><p class="MsoNormal" style="line-height:150%">A fact is a piece of information with a specific numerical value. Facts are kept in fact tables, which are linked to several dimension tables by a foreign key. Fact Tables&nbsp;contain numerical data necessary for effective data analysis and decision-making. A fact table is also a table that stores the measurements, metrics, or facts related to a business operation.&nbsp;It is located at the center of a star or snowflake schema and is surrounded by dimension tables. A fact table also contains the records that combine attributes from different dimension tables. These records allow users to analyze different aspects of their business, which can aid in decision-making and improving the business. A fact table has two types of columns: those that contain the facts and those that serve as&nbsp;<a href="https://www.simplilearn.com/tutorials/sql-tutorial/foreign-key" target="_blank" title="foreign keys">foreign keys</a>&nbsp;linking to dimension tables.&nbsp;The&nbsp;<a href="https://www.simplilearn.com/tutorials/sql-tutorial/primary-key-in-sql" target="_blank" title="primary key">primary key</a>&nbsp;of a fact table is often a composite key made up of all of the foreign keys in the table.&nbsp;It can hold various types of measurements, such as additive, non-additive, and partly additive measures, and store important information in the data warehouse.&nbsp;</p><p class="MsoNormal" style="line-height:150%"><b>Characteristics of a Fact Table</b></p><ol start="1" type="a"> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>Keys:</b> Each fact table has a key that is made up of the primary keys from all of the dimension tables connected to that fact table.</li> </ol><p class="MsoListParagraph" style="text-indent:-.25in;line-height:150%; mso-list:l3 level1 lfo2">b.&nbsp;&nbsp;&nbsp; <b>Additive Measures:</b> The fact table's attributes may be entirely, partially, or not at all additive. Measures that are applied to all dimensions are referred to as fully addition or additive measures.</p><ol start="3" type="a"> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>Quasi-Measures:</b> are those that store the fundamental unit of measurement for any business process, whereas semi-additive measures add measures to some dimensions but not to all.</li> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>Sparse Data:</b> Some records in the fact table have characteristics with null values or measurements, which means that the information they contain is not given or provided. </li> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>Table Grain:</b> The level of detail or depth of the information recorded in a fact table is referred to as the table's grain. A successful fact table must be designed at the highest level. </li> </ol><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 2.25in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>Types of Facts</b></p><p class="MsoListParagraphCxSpFirst" style="text-indent:-.25in;line-height:150%; mso-list:l4 level1 lfo3">1.&nbsp;&nbsp;&nbsp; Additive Facts: This states that all dimensions should be multiplied by measures.</p><p class="MsoListParagraphCxSpMiddle" style="text-indent:-.25in;line-height:150%; mso-list:l4 level1 lfo3">2.&nbsp;&nbsp;&nbsp; Non-Additive:&nbsp; This means that measures may be introduced to some dimensions in this type of data but not to others.</p><p class="MsoListParagraphCxSpLast" style="text-indent:-.25in;line-height:150%; mso-list:l4 level1 lfo3">3.&nbsp;&nbsp;&nbsp; Semi-Additive: This keeps track of some fundamental business process metrics. Examples include orders, phone calls, and sales. </p><p class="MsoNormal" style="line-height:150%">&nbsp;</p><p class="MsoNormal" style="line-height:150%"><b>What is a Dimension Table?</b><b></b></p><p class="MsoNormal" style="line-height:150%">Dimension tables provide the context and background information for the measures recorded in the fact table. One of the main differences between fact tables and dimension tables is that dimension tables contain the attributes that the measures in the fact table are based on. Dimension tables contain descriptions of the objects in a fact table and provide information about dimensions such as values, characteristics, and keys.&nbsp;The term dimension table refers to a set of data related to any quantifiable event and is the foundation for dimensional modeling.&nbsp; Dimension tables have a column that serves as a primary key, allowing each dimension row or record to be uniquely identified. This key is used to link the dimension table to the fact tables. A surrogate key, which is a system-generated key, is often used to uniquely identify the rows in the dimension table.</p><p class="MsoNormal" style="line-height:150%">&nbsp;</p><p class="MsoNormal" style="line-height:150%">&nbsp;<b></b></p><p class="MsoNormal" style="margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>Characteristics of a Dimension Table</b></p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 0.75in; text-indent: -0.5in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">i.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; These tables are usually small, with a number of rows ranging from a few hundred to a few thousand.&nbsp;</p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 0.75in; text-indent: -0.5in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">ii.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Records: The dimension table contains more characteristics than records.</p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 0.75in; text-indent: -0.5in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">iii.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Keys: The main key is required for every dimension table in order to help uniquely identify each entry.</p><p class="MsoListParagraph" style="margin-bottom: 10.5pt; margin-left: 0.75in; text-indent: -0.5in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">iv.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://www.simplilearn.com/automated-recruiting-in-companies-article" target="_blank" title="Normalization">Normalization</a>: The dimension table is not normalized because doing so splits the data into different tables and makes it more difficult for queries to execute. </p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 0.75in; text-indent: -0.5in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">v.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attribute Values: The majority of the values in the dimension table are expressed as text rather than numbers.</p><p class="MsoNormal" style="margin-bottom: 19.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>Types Of Dimensions:</b></p><ul type="disc"> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">Role-Playing Dimensions</li> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">Step Dimensions</li> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">Degenerate Dimensions</li> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">Conformed Dimensions</li> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">Junk Dimensions</li> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">Swappable Dimensions</li> <li class="MsoNormal" style="color: black; margin-bottom: 10.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">Dimension-to-Dimension Table Joins</li> </ul><p class="MsoNormal" style="margin-bottom: 19.5pt; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>The key differences between Fact and Dimension Tables are as follows:</b></p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 51pt; text-indent: -0.25in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A Fact table is characterized by its grain or even most atomic level, while the Dimension database includes extensive information, the Fact table is used to hold report labels.</p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 51pt; text-indent: -0.25in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In contrast to the Dimension table, which incorporates hierarchies, the Fact table does not.</p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 51pt; text-indent: -0.25in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The Dimension table is a partner to the fact table and contains descriptive qualities that can be used as query constraints. The fact table includes measurements, metrics, or facts about business operations.</p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 51pt; text-indent: -0.25in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">·&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A star and snowflake schema's core is where the table containing it is located, while its edges are where the dimension table is situated. </p><p class="MsoListParagraph" style="margin-bottom: 10.5pt; text-indent: -0.25in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Difference between Snowflake Schema and Star Schema</p><p class="MsoNormal" style="margin-bottom: 10.5pt; margin-left: 0.25in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><b>What is a Star Schema?</b></p><p class="MsoNormal" style="margin-bottom: 10.5pt; text-indent: 0.25in; line-height: 150%; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">A star schema is a database schema used to store data in a star format. This schema consists of a central table called the <b>"Fact Table,"</b> and a number of directly connected other tables called <b>"Dimension Tables.</b> The fact table contains information about metrics or measures, while the dimension tables contain information about descriptive attributes. The star schema is very simple and easy to understand, making it ideal for&nbsp;business intelligence applications. This schema contains both dimension tables and Fact tables in it. </p>What is a Snowflake Schema? <p style="line-height: 21pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">A snowflake schema is a type of database schema that is used to store data in a more complex format than the star schema. The snowflake schema consists of a central table which is called the fact table and a number of other tables which are called dimension tables.&nbsp; As with other schemas, the fact table contains information about events or facts while the dimension tables contain information about the dimensions of those events or facts.&nbsp;This schema also contains all the three dimensions, fact tables and the sub-dimension tables. </p>Key Differences Between Star Schema and Snowflake Schema:<p style="margin: 0in 0in 5pt 24.75pt; text-indent: -0.25in; line-height: 21pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">1.&nbsp;&nbsp;&nbsp;&nbsp; A star schema has denormalized dimension tables, while a snowflake schema has normalized dimension tables.</p><p style="margin: 0in 0in 5pt 24.75pt; text-indent: -0.25in; line-height: 21pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">2.&nbsp;&nbsp;&nbsp;&nbsp; A star schema is easier to design and implement than a snowflake schema.</p><p style="margin: 0in 0in 5pt 24.75pt; text-indent: -0.25in; line-height: 21pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">3.&nbsp;&nbsp;&nbsp;&nbsp; A star schema can be more efficient to query than a snowflake schema, because there are fewer <b>JOINs</b> between tables.</p><p style="margin: 0in 0in 5pt 24.75pt; text-indent: -0.25in; line-height: 21pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">4.&nbsp;&nbsp;&nbsp;&nbsp; A star schema can require more storage space than a snowflake schema, because of the denormalized data. </p><p style="margin: 0in 0in 5pt 24.75pt; text-indent: -0.25in; line-height: 21pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">5.&nbsp;&nbsp;&nbsp;&nbsp; A star schema can be more difficult to update than a snowflake schema, because of the denormalized data.</p><p class="MsoNormal" style="line-height: 150%;"> </p><p style="margin: 0in 0in 5pt 24.75pt; text-indent: -0.25in; line-height: 21pt; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">6.&nbsp;&nbsp;&nbsp;&nbsp; A star schema can be more difficult to troubleshoot than a snowflake schema, because of the denormalized data.&nbsp;</p>

  • 0 Comments
  • 52 Views
  • Share: