Page 32 - Computing Book 8
P. 32

Handling Databases                                                                   Class 8


               vehicle identification number (VIN). A relational database must always have one and only one
               primary key. Primary keys typically appear as columns in relational database tables.

               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 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.
               After entering the fields name and assigning them their relevant data type save the table and you
               will notice that a dialogue box will appear with the exclamation mark suggesting:








               The City School /Academics/Computing Curriculum/Class 8/2020-2021                Page 31 of 75
   27   28   29   30   31   32   33   34   35   36   37