Page 323 - TP_IT_V1.0_C10_flipbpookl
P. 323

CLOSING LIBREOFFICE BASE

                 To close the application window of LibreOffice Base, click on the File  Close or click on the Close (x) button of the
                 LibreOffice Base window.


                         WHAT ARE RELATIONSHIPS?

                 As we know, a database contains different related tables. Sometimes, we need data from different tables at the same
                 time. In such cases, these tables need to be linked based on a common field.
                 Relationships help you join two or more tables using a common field so that common data can be retrieved from
                 multiple tables at the same time.

                 The most important prerequisite for setting a relationship is that there must be a common field(s) between the two
                 tables to create a relationship. Also ensure that the data types of the common field in both the tables must be same.
                 If they are not same then LibreOffice Base will display an error message and will not allow to set the relationship
                 between the two tables.

                 Let us consider an example of a database containing following two tables—STUDENT and MARKS.

                 In STUDENT table - AdmNo is the primary key. In MARKS table - RollNo is the primary key and AdmNo is the foreign
                 key. So, each record in STUDENT table has a value of AdmNo that corresponds to a record in MARKS table with same
                 value of AdmNo.

                      Student Table
                       AdmNo      Name       Class      Address           Marks Table
                         1011    Arshia       12     RK Puram             RollNo   Admno      UT    Term 1  Term 2
                         1231    Advika       12     Defence Colony                         Marks    Marks   Marks
                         1411    Aekagra      10     Safdarjung              1      1231      89      81       91
                         1422    Divit         9     Preet Vihar             2      1411      80      85       92
                         1324    Akshaj       11     Jasola                  3      1324      78      87       91

                 Once the relationship between the two tables has been set, the integrity of data will be managed by the DBMS. That
                 means once a student’s record has been entered in the STUDENT table, only then that Admission number can be
                 entered in the MARKS table. Thus, STUDENT table is called MASTER TABLE with master record while the MARKS table
                 is called the TRANSACTION TABLE with the corresponding record matching with master record is called as transaction
                 record.

                 The main advantages of Relating Tables in a Database are:
                 •  A relationship can help prevent data redundancy and it saves time as the common data need not to be repeated in
                   different tables.
                 •  It helps prevent missing data by keeping deleted data from getting out of sync. This is called referential integrity.
                 •  Creating relationships between tables restricts the user from entering invalid data in the referenced fields.
                 •  Any update in the master table is automatically reflected in the transaction tables.
                 Types of Relationships

                 There are three important types of relationship that can be created in a database which are as follows:
                 •  One-to-One: In this type “One record of Master table is related to only one record of Transaction Table”. It is
                   represented as a 1:1 relationship.



                                                                        Database Management System using LibreOffice Base  321
   318   319   320   321   322   323   324   325   326   327   328