Concepts / Database Schema Design and Normalization

Database Schema Design and Normalization

Primary and foreign keys are omitted from simplified data model diagrams because their placement follows an absolute, predictable rule: primary keys in the 'one' end, foreign keys in the 'many' end.

  • Programming

The Missing Keys Puzzle

When you first learn databases, primary keys and foreign keys appear essential because they implement relationships between tables. Yet a conceptual data model diagram may show only entities and a relationship line, with no key columns at all. This is not an accidental omission. The relationship line follows a predictable pattern that lets you reconstruct the missing key structure.

What do you think happens?

A simplified diagram shows Customers connected to Orders with a one-to-many relationship. What can you infer even though no key columns are displayed?

  • Customers has a primary key and Orders has a matching foreign key
  • Orders has a primary key and Customers has a matching foreign key
  • Neither entity needs a key
  • The diagram provides no information about keys
Reveal answer

Answer: Customers has a primary key and Orders has a matching foreign key

In the one-to-many pattern, the primary key belongs at the one end and the corresponding foreign key belongs at the many end. The diagram omits the columns, but the relationship line communicates the pattern.

Following the Relationship Line

Read a one-to-many relationship in two stages. First, identify the entity at the one end and the entity at the many end. Next, apply the key-placement rule: the one end contains the primary key, while the many end contains the corresponding foreign key. The relationship line therefore acts as shorthand for the key mechanism that connects the two entities.

one-to-manyCustomersone side: primary keyOrdersmany side: foreign key
How does a relationship line show which side contains the primary key and which side contains the corresponding foreign key?

The one end identifies the entity whose primary key is referenced. The many end identifies the entity where the corresponding foreign key is placed.

Conceptual and Implementation Views

A conceptual data model focuses on what the data represents: entities and the relationships between them. Primary and foreign key columns are treated as implementation details because they are the technical mechanism used to enforce those relationships. Omitting them keeps the diagram clean while preserving the essential relationship structure.

key connectionone-to-manyCustomerscustomer_id: primary keyCustomersoneOrderscustomer_id: foreign keyOrdersmany
What information is removed from a simplified conceptual diagram, and what predictable relationship rule lets you reconstruct it?
Conceptual data modelImplementation diagram
Shows entities and their relationshipsShows entities, columns, keys, and key constraints
Leaves primary and foreign key columns outDisplays the exact key columns needed to build the database
Useful for communication and high-level designUseful for database construction, SQL writing, and troubleshooting
Emphasizes what the data representsEmphasizes how the database is technically built

Reconstructing Customers and Orders

Reading a Simplified Relationship

A conceptual diagram shows Customers connected to Orders by a one-to-many relationship. Infer the omitted key structure.

Identify the one end: Customers is at the one end of the relationship.

Place the primary key: The one end represents a primary key in Customers. In the full implementation diagram, this is customer_id.

Identify the many end: Orders is at the many end because one customer can be associated with many orders in the relationship shown.

Place the foreign key: The many end represents the corresponding foreign key in Orders. In the full implementation diagram, Orders contains customer_id as the foreign key connecting back to Customers.

The conceptual diagram can omit both key columns because its one-to-many line allows the viewer to infer a primary key in Customers and a matching foreign key in Orders.

one-to-manyCustomersoneOrdersmany
How can you infer the omitted primary and foreign keys when a diagram shows only entities and relationship cardinality?

The important reading skill is not memorizing a hidden column name. It is recognizing the structural pattern. The diagram tells you which entity is at the one end and which is at the many end; the rule then tells you where the primary key and matching foreign key belong.

Mistakes in Diagram Reading

  • Assuming that omitted keys are unnecessary

    The keys are omitted from the simplified view, but they remain essential to how the database implements the relationship.

    Fix: Read the conceptual line as a shorthand for the key relationship, then consult or create an implementation diagram when building the database.

  • Putting the foreign key at the one end

    The stated placement pattern puts the primary key at the one end and the corresponding foreign key at the many end.

    Fix: Start with cardinality: one end means primary key; many end means corresponding foreign key.

  • Expecting a conceptual diagram to show every column

    Conceptual diagrams are designed to communicate entities and relationships without implementation detail and visual clutter.

    Fix: Use a full implementation diagram when exact columns and constraints are required.

Choose the diagram level according to the task and audience. Use the simplified conceptual representation for communication and high-level design. Use the implementation representation when constructing the database, writing SQL, or troubleshooting a schema problem.

Practice the Inference

EASY

A simplified diagram shows Products at the one end of a one-to-many relationship and LineItems at the many end. Without adding any columns to the diagram, state which entity contains the primary key and which entity contains the corresponding foreign key. Then explain why the simplified diagram can omit both columns.

Hints
  • Identify the one end and the many end first.
  • Apply the rule that places the primary key at the one end and the foreign key at the many end.
  • Explain the difference between the conceptual relationship and the implementation mechanism.

Expected reasoning: Products is the one end, so its primary key is implied. LineItems is the many end, so its corresponding foreign key is implied. The columns are omitted because the one-to-many relationship line communicates their predictable placement in the conceptual view.

What to Remember

  1. A simplified conceptual diagram may omit primary and foreign key columns because their placement follows a predictable one-to-many rule.
  2. The primary key belongs at the one end of the relationship, while the corresponding foreign key belongs at the many end.
  3. Entities and relationships are essential conceptual information; explicit key columns are implementation details in this diagram context.
  4. Use simplified diagrams for communication and high-level design, but use implementation diagrams for database construction, SQL writing, and troubleshooting.
  5. When reading a simplified diagram, reconstruct the missing key structure from the relationship cardinality.

Key Takeaways

  • Primary and foreign keys may be omitted from conceptual diagrams without losing the essential relationship structure.
  • In a one-to-many relationship, the primary key is at the one end and the corresponding foreign key is at the many end.
  • Conceptual diagrams communicate what data represents, while implementation diagrams show how the database is built.
  • The relationship line lets readers infer the omitted key mechanism.
  • Exact keys and columns are still required when constructing databases, writing SQL, or troubleshooting schemas.