Page 72 - Computing book 6
P. 72

Handling Databases – MS Access                                                       Class 6


               When you design a database, you divide your information into tables, each of which has a primary
               key and then add foreign keys to related tables that reference those primary keys.
               These foreign key-primary key pairings form the basis for table relationships and multi-table queries.


























               Foreign Key:
               A foreign key is a column or group of columns in a relational database table that provides a link
               between data in two tables. It acts as a cross-reference between tables because it references the
               primary key of another table, thereby establishing a link between them.

               Constraints in a Database:
               In a database when we define any field as a Primary Key (PK) there are two rules or constraints
               applied to that field automatically.

               NOT NULL: This constraint enforces that this field cannot be left unused. In Database terminology,
               NOT NULL is not considered as empty or zero, it just defined as the data has not been entered yet.

               Unique: This constraint enforces that the data entered in this field cannot be repeated or all the
               values entered should be unique to each other.

               Creating Relationships in MS Access:
               For creating relationships in our database, we
               need another table and will name it tblHRData
               using Table Design as shown in the image.
               Make sure to select the relevant data type
               according to fields.















               The City School /Academics/Computing Curriculum/Class 6/2020-2021                Page 71 of 94
   67   68   69   70   71   72   73   74   75   76   77