The IDs in each of the upper three circles indicate the object’s primary key. This is the id that uniquely identifies the entry in a document or table. The FK in the diagram is the foreign key. This is what links the relationship from one table to the next.
- Primary key: identify a record in the table
- Foreign key: primary key for another table
Entity-relationship models can be created all sorts of ways, and online tools exist to assist in building charts, tables, and even the SQL to create your database from your existing ER Model. This will help to build the physical representation of your database schema.
Physical#
The physical database schema represents how data is represented and stored on disk storage. To create a physical scheme, in a relational database we use SQL commands. For instance, in MySQL, you will use SQL to construct a database with tables.
Compared to the logical schema, the physical schema includes everything needed to create a relationship between tables such as indexes, linking tables, partitioned tables, etc.
Now that we are familiar with the basics of database schema, let’s look at a few examples. We will go over the most common examples you can expect to encounter.