Part 2 of 5 · 1 min read
Entities become tables
Each entity's attributes become a table's columns.
Think of a blueprint turning into an actual room. Each labelled wall on the blueprint becomes a real wall.
In plain words: each entity becomes a table. Each of its attributes becomes a column. A chosen identifying attribute, or a new surrogate key, becomes the primary key.
A worked example. Customer (customer_id, full_name, address) is the direct result of mapping the Customer entity and its attributes.
The key lines.
CREATE TABLE customers (
customer_id INTEGER PRIMARY KEY,
full_name TEXT NOT NULL,
address TEXT NOT NULL
);
Entity-to-table mapping
Entity-to-table mapping turns each entity into a table, each attribute into a column, and an identifying attribute into the primary key.
Example: the Customer entity becomes the customers table, with customer_id as its primary key.