Ir para o conteúdo

Lição 1 · Getting Started

What Is a Data Warehouse?

Learn what a data warehouse is, why organizations build one, who works with it, what you need to know first, and how this tutorial is organized.

A data warehouse is a database built for answering questions about a business. It collects data from the systems that run the organization, such as the web shop, the billing system and the support tool, and stores it in a shape that makes questions like "How did sales in each region change over the last two years?" easy and fast to answer.

This tutorial teaches you how a warehouse is designed, loaded, queried and looked after. It is independent: it is not made or endorsed by any database or cloud vendor, and the ideas apply to all of them.

The problem a warehouse solves

Picture Harbor Outfitters, an imaginary outdoor-gear retailer that you will meet in many lessons. Orders live in the web shop database, store sales in the point-of-sale system, customer details in a marketing tool, and returns in a spreadsheet. A simple question, "Which customers bought boots and then returned them?", now needs data from several places that use different IDs, date formats and definitions.

Without a warehouse, someone exports files, joins them by hand and hopes the numbers match last month's. With a warehouse, that work is done once, by an automated process that everyone can inspect, and the result is a single set of tables that reports and analysts share.

A warehouse typically gives you four things:

  • Integration. Data from many sources is cleaned and given common keys and names.
  • History. It keeps what was true in the past, even after the source system has overwritten it.
  • Consistency. "Net revenue" is calculated one agreed way.
  • Performance for analysis. Large scans and summaries run without slowing down the systems that take orders.

The classic definition

Bill Inmon, who is often called the father of the data warehouse, described it with four properties. In plain words:

Property Meaning
Subject-oriented Organized around topics such as sales or customers, not around applications
Integrated Sources are made consistent with each other
Time-variant Records are tied to points or periods in time, so history is available
Non-volatile Loaded data is kept and not casually overwritten or deleted

Real warehouses bend these rules when they must, for example to delete personal data on request. Treat them as goals.

A first taste

The block below creates two tiny "source" tables that disagree about how to write a country, and then builds one clean table from them. That is warehousing in miniature.

SQL Two sources, one clean view

Press Run (or Ctrl + Enter) to see the result here.

The view does three jobs: it maps country names to codes, converts cents to currency units, and labels each row with its channel. A real warehouse stores the results in tables and runs the process on a schedule, but the thinking is the same.

Who works with a warehouse?

  • Data engineers and analytics engineers move and transform data.
  • Data modelers or architects decide what the tables look like.
  • Analysts and BI developers write queries and build dashboards.
  • Business users read the dashboards and ask new questions.
  • Data owners and governance staff decide what data means and who may see it.

In a small company one person may do all of these.

What you need, and what this tutorial can run

You should be comfortable with basic SQL: SELECT, WHERE, GROUP BY and joins. If those are new, start with the SQL tutorial. No cloud account is needed.

The runnable SQL blocks use SQLite inside your browser. Each block creates its own tables, so you can edit anything and run it again. SQLite is a small row-based database, not a warehouse platform. That has consequences:

  • Modeling, loading and most analytical queries work well here.
  • Features such as columnar storage, partitioning, materialized views, MERGE, ROLLUP and role-based security are missing. Lessons show them as read-only code or simulate the idea with a clearly labeled stand-in.
  • Timing results here say nothing about how a large warehouse performs.

Syntax differs between platforms, so check your own platform's documentation before you copy a read-only statement.

Course map

Foundations

Getting started What and why; OLTP vs OLAP
Architecture Layers, approaches, cloud
1 / 4

Do you need a warehouse yet?

Not every organization needs one on day one. A warehouse is a system that someone must build, pay for and look after. It starts to earn its keep when several of these are true:

  • Important questions need data from two or more systems.
  • People spend hours each week exporting and joining files by hand.
  • Two reports show different values for the same measure, and nobody can say why.
  • You need to compare with the past, but the source systems keep only the current state.
  • Reporting queries slow down the application that serves customers.

If none of these apply, a few saved queries against a read-only copy of one database may be enough. It is perfectly reasonable to start small: one business process, one or two sources and a handful of well-named tables. The same ideas scale up later.

How a warehouse project usually goes

A warehouse is never really "finished", but a first delivery tends to follow a recognizable path:

  1. Listen. Collect the questions people need answered and the decisions that depend on them.
  2. Explore the sources. Look at real data. Find missing values, duplicate records and codes that nobody documented.
  3. Design. Choose a business process, declare what one row means and agree on definitions.
  4. Load. Build a repeatable pipeline from the sources into the new tables.
  5. Check. Compare totals with the source and ask a person who knows the business to review them.
  6. Publish and listen again. Watch how people use the tables, then improve them.

The listening steps matter as much as the technical ones. A technically excellent model that answers the wrong question will not be used. A common success test for the first release is simple: can one important report be produced from the warehouse, with numbers the business accepts, without any manual editing?

Words that sound alike

You will meet several related terms. A database is any organized store of data. A data warehouse is a database (or platform) designed for integrated analysis. A data mart is a focused slice for one subject or team. Business intelligence (BI) usually means the reports, dashboards and tools that people use on top of the warehouse. Data warehousing is the whole practice: design, loading, quality, security and operation.

Common mistakes

A warehouse is not just a copy of the production database on a bigger server. If you copy tables as they are, you copy their confusing names, missing history and inconsistent codes too. The value comes from design and agreed definitions.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is the main purpose of a data warehouse?

    A warehouse brings sources together, keeps history and is shaped for analytical questions.
  2. 2. What does time-variant mean?

    Warehouses record when something was true, which makes trends and past states available.
  3. 3. Which statement about the runnable examples in this tutorial is correct?

    SQLite is good for modeling and SQL practice but lacks many warehouse platform features.
  4. 4. Why is a plain copy of a source database not a good warehouse?

    Integration, history and agreed meaning are what the warehouse adds.

Summary

  • A data warehouse is a database designed for analysis, fed from operational systems.
  • It adds integration, history, consistent definitions and analytical performance.
  • The classic properties are subject-oriented, integrated, time-variant and non-volatile.
  • The examples here run on SQLite; platform-only features are read-only or stand-ins.

Next: OLTP vs OLAP

Seu progresso fica salvo neste navegador. Não precisa de conta.