About Lesson
Relational Model:
The Relational Model in Database Management Systems (DBMS) is a way of structuring data using tables and relationships. It was introduced by Edgar F. Codd in 1970. In this model, data is organized into tables, where each table represents an entity, and each row in the table represents a specific instance or record of that entity. Tables consist of columns that define the attributes or properties of the entity.
Let’s explain the relational model with examples using “Students” and “Courses” tables:
Students Table:
StudentID | Name | Age | Major |
---|---|---|---|
1 | Alice | 21 | Computer Sci |
2 | Bob | 22 | Chemistry |
3 | Charlie | 20 | Physics |
4 | David | 23 | Mathematics |
5 | Emily | 22 | Biology |
Courses Table:
CourseID | CourseName |
---|---|
101 | Introduction to Computer Science |
102 | Organic Chemistry |
103 | Physics I |
104 | Calculus |
105 | Biology Basics |
Expanation:
- Tables (Relations):
- Each table represents an entity (e.g., “Students” or “Courses”).
- The “Students” table contains information about individual students, while the “Courses” table contains information about different courses.
- Rows (Tuples):
- Each row in a table represents a specific instance or record of the entity.
- For example, the row with “StudentID” 1 in the “Students” table represents the student Alice.
- Columns (Attributes):
- Columns define the properties or attributes of the entities.
- In the “Students” table, “StudentID,” “Name,” “Age,” and “Major” are attributes.
- Primary Key:
- A primary key uniquely identifies each record in a table.
- In the “Students” table, “StudentID” is the primary key, ensuring each student has a unique identifier.
- Foreign Key:
- A foreign key establishes relationships between tables.
- In the “Students” table, “CourseID” is a foreign key that links to the “Courses” table, indicating the course each student is enrolled in.