liveBook · Manning

Database key

As explained in Everyday Data Visualization

A key is a field or mapping structure that identifies or associates corresponding records across data tables or systems.

A database key links corresponding records when two systems store the same information differently. Here, it takes the practical form of a mapping table. section 9.3.1

When team names do not line up

One system might store team names in uppercase with no spaces, while another uses inconsistent formatting. Joining directly on the names may return only a few matches. A mapping table can record which name in one system corresponds to which name in the other. section 9.3.1

Use a key early when:

  • You need to join tables from different systems. section 9.3.1
  • Simple formatting cleanup cannot make values structurally equivalent. section 9.3.1
  • Requirements gathering must confirm that existing data is usable, not merely available. section 9.3.1
Figure 9.9 System A stores team names in the format on the left, uppercase with no spaces, while system B on the right doesn’t follow any particular format. If you try to join these tables on System A’s team name equals system B’s team name, you might, at best, get a few results, but certainly not all of them. You’ll need to find some way to link them.
09-09

Compare the two team-name formats and see why an explicit mapping is needed before joining the tables. section 9.3.1

How Everyday Data Visualization covers it

How deep it goes
Defines a key through a failed join example but stops short of explaining its schema or implementation.
Examples
Uses mismatched team-name formats across two systems as the central example.
What it assumes
Assumes familiarity with tables and joins while emphasizing that requirements gathering must verify usable links.
What you can do after
Diagnose failed cross-system joins and specify a mapping table when formatting cleanup cannot reconcile values.
How it connects
Connects keys to table joins, data cleaning, requirements gathering, and data usability.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Everyday Data Visualization. The section links point to the parts of the book it draws on.