There are several types of relationships:
1. One-to-One (1:1):
- When two Tables In this relationship the one and only one entity of a Table A is their associate/link with one and only one entity of a Table B.
- Each record in the first table is related to one and only one record in the second table, and vice versa.
- It may represent the (|) from the line on both sides or represent the arrow sign on a side.
- A Student may have One CNIC Number.
- A Student may have apply in One Program/Course.
2. One-to-Many (1:N):
- When two Tables In this relationship the one and only one entity of a Table A is their associate/link with more than one entities of a Table B.
- It may represent the Crow foot or Double Headed Arrow many Values.
- Each record in the first table can be related to one or more records in the second table, but each record in the second table is related to only one record in the first table.
- One customer may have multiple orders.
- One Department may have more than one Employees.
- A Teacher may have more than one students.
3. Many-to-One (N:1):
- The reverse of a one-to-many relationship.
- When two Tables In this relationship the more than one entity of a Table A is their associate/link with one and only one entity of a Table B.
- It may represent the Crow foot on left side or Double Headed Arrow many Values.
- Many records in the first table can be related to one record in the second table.
- Many orders may belong to one customer.
- Many Students may have one teacher.
- many Employee may have one department.
4. Many-to-Many (N:M):
- When two Tables In this relationship the more than one entity of a Table A is their associate/link with more than one entity of a Table B.
- Many records in the first table can be related to many records in the second table, and vice versa. This type of relationship requires a junction table (also known as an associative or linking table) to connect the two tables.
- It may represent the Crow foot on both sides or Double Headed Arrow many Values.
- Many students can enroll in many courses.
- Many courses can have many students.
Comments
Post a Comment