Page 324 - TP_IT_V1.0_C10_flipbpookl
P. 324

Let us understand the concept of One-to-One relationship with the help of example.
                                       Person Table

                                          PersonID        Name          Age        Address
                                        (Primary Key)
                                              1            Yash          30          Delhi
                                              2           Mehul          28         Meerut
                                              3           Varun          32          Delhi
                                              4           Neetu          31         Kanpur

                               Passport Table


                                  PassportID     PassportNumber        ExpiryDate        PersonID
                                 (Primary Key)                                         (Foreign Key)
                                      101             A12345           2026-05-15            1
                                      102             B67890           2027-03-20            2
                                      103             A25689           2026-05-15            3
                                      104             C25874           2027-03-20            4
              In the given relationship, each person has exactly one passport, and each passport belongs to exactly one person. So,
              the relationship between Person and Passport tables is one-to-one.
              •  One-to-Many: This is one of the most common types of relationship between the tables in a database. In this
                type “Each record of Master table is related to multiple Records of Transaction table.” It is represented as a 1:n
                relationship.

              Let us understand the concept of One-to-Many relationship with the help of example.

                                      Department Table
                                         DeptID (Primary      DeptName           Location
                                              Key)
                                               1             Engineering          Sonipat
                                               2              Marketing           Meerut
                                               3                Sales              Delhi

                                      Employee Table

                                          EmployeeID            Name              DeptID
                                         (Primary Key)                         (Foreign Key)
                                              101               Yash                 1
                                              102               Mehul                1
                                              103               Varun                2
                                              104               Neetu                3
                                              105               Nisha                2

              In the given relationship,  each department can have  many  employees,  but each  employee  belongs  to only  one
              department. So, the relationship between Department and Employee tables is One-to-Many.








                322   Trackpad Information Technology (Ver. 1.0)-X
   319   320   321   322   323   324   325   326   327   328   329