Page 50 - ModularV1.1 _c8_flipbook
P. 50

SETTING UP RELATIONSHIP

                  An association between two tables on the basis of a common field is called relationship. The
                  common field in the first table is called primary key and in the second table it is called foreign
                  key. The foreign key field must match with the primary key field in the first table. For creating
                  relationship between two tables, we need to first create primary key in both the tables.

                  To create a relationship, create two tables:
                       Table named ‘StudentsDetail’  that
                     holds general  information  about
                     the students such as their Roll No.,

                     Name, Father’s Name and Class.                      Using tables for defining relationships
                      Table named ‘StudentsMarks’ that holds information about Roll No, Marks and Percentage.

                  To define the relationship between the two tables, follow these steps:
                  Step 1  Click  on the  Relationships command from the
                          Relationships group under the Database Tools tab.

                  Step 2  The  Show  Table dialog box will open. Click  on
                          the  Add  button.  The selected table will appear  in
                                                                                            Database Tools tab
                          the relationship window. After  adding  the desired
                          tables, click on the Close button to close the Show Table dialog box.

                  Step 3  Click and hold on the Primary Key field of one table.
                  Step 4  Drag the mouse pointer to the common field in the other table and release the mouse

                          button.
                  Step 5  This will open the Edit Relationships dialog box. Click on the Create button.

















                                       Show Table dialog box            Relationships dialog box
                  This will create a line or relationship between the related fields of the two tables:





                                                                    Relationship established between 'StudentsDetail'
                                                                    table and 'StudentsMarks' table based on the
                                                                    Primary Key named ‘Roll No’.
                              Relationship Created



                  48      Modular (Ver. 1.1)-VIII
   45   46   47   48   49   50   51   52   53   54   55