Page 214 - IT_V1.0_Class10
P. 214

  Relationships: Relationships define how tables within a database are related to each other.  Common types
                 of relationships include one-to-one, one-to-many, and many-to-many. These relationships are established
                 using foreign keys, which are fields in one table that reference the primary key of another table.

                Constraints: Constraints are rules that enforce data integrity within a database. They define the conditions
                 that must be met for data to be inserted, updated, or deleted in a table. Common types of constraints
                 include primary key constraints, foreign key constraints, unique constraints, and check constraints.
                Degree: This refers to the number of attributes or columns in a table. For example, if a Employee table has
                 four columns (attributes), then the degree of the table is 4.

                Cardinality: This refers to the number of tuples or rows in a table. For example, if a Employee table has
                 5 rows, then the cardinality of the table is 5.

                 KEY FIELD

              In the LibreOffice Base, data between tables can be related on the basis of a common field called key field.
              The key field links the data between two or more tables. LibreOffice Base sets the relationship by comparing
              the key fields of tables. Users can specify a link between two tables on the basis of key fields by creating a
              relationship.

              Primary Key

              Primary key is a field that is used to uniquely identify records in a database. It ensures that every row has a
              distinct value, preventing duplicates. A primary key cannot contain null values and must be unique. A table
              can only have one primary key. If there are more than one field is consider as primary key, then there will be
              two identities against a row. But, there can be only one identity against a row. So, we cannot have more than
              one primary key. To make the retrieval of records faster, Primary keys are indexed in database.
              For example, In the given STUDENT table, the primary key is the STU_ID column as it uniquely identifies
              each record.
                                                          Table: Student
                                 Primary key                                    Alternate Key


                                  STU_ID            S_NAME             AADHAR             PASSPORT

                                     1         PRIYANKA                   1234              A1478
                                     2         ADITI                      1254              A1236

                                     3         DEV                        1247              A4569

                                                    Candidate Key


              Candidate Key

              An attribute or a set of attributes that can uniquely identify a record and is capable of being a primary key is
              called a candidate key. In the Student TABLE, STU_ID, AADHAR, and PASSPORT are the candidate keys as they
              have chances of unique values. We can have atleast one candidate key in a table.

              Alternate Key

              A remaining candidate key that is not selected as the primary key is called an alternate key. In the table
              Student, the primary key is STU_ID, and the alternate key is AADHAR and PASSPORT.



                212     Information Technology Play (Ver 1.0)-X
   209   210   211   212   213   214   215   216   217   218   219