Types of Relationships in Relational Databases
Q: What are the common types of relationships between tables in a relational database?
- Database Design and Normalisation
- Junior level question
Explore all the latest Database Design and Normalisation interview questions and answers
ExploreMost Recent & up-to date
100% Actual interview focused
Create Database Design and Normalisation interview for FREE!
In a relational database, the common types of relationships between tables are:
1. One-to-One (1:1): In this relationship, a record in Table A is associated with only one record in Table B, and vice versa. For example, consider a database with a table for Employees and a table for EmployeeDetails. Each employee has exactly one set of details.
2. One-to-Many (1:N): This is the most common relationship, where a record in Table A can be associated with multiple records in Table B, but a record in Table B is associated with only one record in Table A. For example, in a database with a Customers table and an Orders table, a single customer can place multiple orders, but each order is placed by only one customer.
3. Many-to-One (N:1): This is essentially the reverse of the one-to-many relationship. Many records in Table B can relate to a single record in Table A. Using the previous example, multiple orders (Table B) can relate to one customer (Table A).
4. Many-to-Many (M:N): In this relationship, records in Table A can relate to multiple records in Table B, and vice versa. To implement this, a junction table (associative entity) is typically used. For instance, in a database with Students and Classes, a student can enroll in multiple classes and a class can have multiple students. We could create a StudentClasses junction table to represent this relationship.
These relationships are fundamental to designing an efficient database structure, enabling proper data normalization and integrity.
1. One-to-One (1:1): In this relationship, a record in Table A is associated with only one record in Table B, and vice versa. For example, consider a database with a table for Employees and a table for EmployeeDetails. Each employee has exactly one set of details.
2. One-to-Many (1:N): This is the most common relationship, where a record in Table A can be associated with multiple records in Table B, but a record in Table B is associated with only one record in Table A. For example, in a database with a Customers table and an Orders table, a single customer can place multiple orders, but each order is placed by only one customer.
3. Many-to-One (N:1): This is essentially the reverse of the one-to-many relationship. Many records in Table B can relate to a single record in Table A. Using the previous example, multiple orders (Table B) can relate to one customer (Table A).
4. Many-to-Many (M:N): In this relationship, records in Table A can relate to multiple records in Table B, and vice versa. To implement this, a junction table (associative entity) is typically used. For instance, in a database with Students and Classes, a student can enroll in multiple classes and a class can have multiple students. We could create a StudentClasses junction table to represent this relationship.
These relationships are fundamental to designing an efficient database structure, enabling proper data normalization and integrity.


