Database Design Fundamentals: Understanding Entities, Tables, and Relationships
Introduction
Welcome to the Database Design Fundamentals series — a beginner-to-advanced journey into the world of database design.
In this first post, we’ll start at the foundation: entities, tables, and relationships. Whether you’re a student learning databases for the first time or a developer aiming to build structured systems, understanding these core concepts is essential.
By the end of this article, you’ll know what entities are, how they translate into tables, and why relationships define the true power of databases.
What Are Entities?
Think of an entity as a real-world object or concept you want to store information about.
Example: In a school system, entities could be Students, Courses, and Teachers.
Each entity represents something meaningful in the problem domain.
👉 In database design, entities are the blueprints for tables.
From Entities to Tables
When you design a database, entities are mapped into tables.
Students (Entity) → Students Table
Columns:
StudentID,Name,DateOfBirth,Email
Courses (Entity) → Courses Table
Columns:
CourseID,CourseName,Credits
Teachers (Entity) → Teachers Table
Columns:
TeacherID,Name,Department
Each row in a table represents a single instance of that entity.
Example: One row in the Students table = one student.
What Are Relationships?
Entities rarely exist in isolation. They are connected.
A student enrolls in a course.
A teacher teaches many courses.
These connections are called relationships.
Types of Relationships
One-to-One (1:1)
Example: Each student has one student ID card.
Student → StudentCard
One-to-Many (1:N)
Example: One teacher teaches many courses.
Teacher → Courses
Many-to-Many (M:N)
Example: Many students enroll in many courses.
Solved with a join table (e.g.,
EnrollmentswithStudentID,CourseID).
Why Relationships Matter
Without relationships, a database would just be a collection of flat spreadsheets. Relationships allow:
Data Integrity: Prevent duplicate or inconsistent data.
Flexibility: Query across multiple entities.
Scalability: Model real-world complexity.
Example: Want to know which students are in a teacher’s course? Relationships make that query possible.
Real-World Analogy
Imagine a library system:
Books (Entity/Table) → each row is a book.
Members (Entity/Table) → each row is a library member.
Loans (Relationship) → connects which member borrowed which book.
Without relationships, you’d struggle to track who borrowed what and when.
Conclusion & Next Steps
Entities, tables, and relationships are the core building blocks of every database. Mastering them ensures your database can reflect real-world scenarios accurately and efficiently.
In the next post, we’ll dive into primary keys, foreign keys, and constraints — the rules that keep your tables organized and your relationships consistent.
Related
WAL, Crash Recovery and Durability: How Databases Survive Power Failures
How does a database survive a server crash without losing data? The Write-Ahead Log is the answer. This post explains WAL, ARIES recovery, and what durability actually guarantees.
B-Tree vs LSM-Tree: Why InnoDB and RocksDB Make Different Trade-offs
InnoDB uses B-Tree. RocksDB uses LSM-Tree. The choice determines read speed, write speed, and space amplification. Understanding both unlocks every storage engine decision.
How Databases Store Data: Pages, Heap Files and Row vs Column Storage
Every query you write becomes disk I/O. Understanding how databases store data — pages, heap files, row vs column layout — explains why some queries are fast and others are not.
Comments