Understanding data in Ms Access
Understanding data in Ms Access
One-to-One Relationship
A one-to-one relationship exists when a single record in one table
corresponds to exactly one record in another table. This type of
relationship is often used to store additional information about a
primary entity.
Example: A "Students" table might have a one-to-one
relationship with a "Medical Records" table. Each student would
have only one medical record, and vice versa.
One-to-Many Relationship
A one-to-many relationship occurs when a single record in one
table can be associated with multiple records in another table.
This is a common relationship type in databases.
Example: A "Departments" table might have a one-to-many
relationship with an "Employees" table. A department can have
many employees, but an employee belongs to only one
department.
Many-to-Many Relationship
A many-to-many relationship occurs when a record in one table
can be associated with multiple records in another table, and vice
versa. This type of relationship is often implemented using a
junction table.
Example: A "Students" table might have a many-to-many
relationship with a "Courses" table. A student can take multiple
courses, and a course can have multiple students enrolled.
Referential Integrity
Referential integrity ensures that data in related tables is
consistent. It prevents actions that would violate the defined
relationships, such as deleting a record in a parent table that has
corresponding records in a child table.
By enforcing referential integrity, you can maintain the accuracy
and consistency of your data, preventing errors and
inconsistencies.