Facts and Dimension Table
In simple terms, facts and dimension tables are two types of tables commonly used in data warehousing and analytics:
Facts Table:
A facts table contains quantitative data, often referred to as "facts" or "metrics," that represent business activities or events. E.g In a sales database, a facts table might contain metrics such as sales revenue, quantity sold, and profit. Facts tables often have foreign keys that reference dimension tables to provide context for the facts.
Dimension Table:
A dimension table contains descriptive attributes that provide context or details about the facts in the facts table. E.g In the same sales database, dimension tables might include information about products (e.g., product name, category), customers (e.g., customer name, region), and time (e.g., date, month, year). Dimension tables contain textual or categorical data that describe the facts. Dimension tables often have primary keys that are referenced as foreign keys in the facts table to establish relationships.
In essence, facts tables contain the quantitative data or "what happened," while dimension tables provide the descriptive context or "how," "where," and "when" of the events captured in the facts table.