Page 215 - IT_V1.0_Class10
P. 215

Composite Key

                 A composite key is also called a composite primary key. It refers to a combination of two or more fields that
                 can uniquely identify or retrieve records. For example, the STU_ID and the AADHAR fields in a student table
                 can be used as a Composite key to uniquely identify each record in the table.

                 Foreign Key

                 The main table of a database is referred to as the ‘Master Table’ and the tables in which the related data is
                 stored are referred to as ‘Transaction Table’. The tables are related and are linked through a field which is
                 common. This common key field in the transaction table is called the ‘Foreign key’ and its value depends
                 on the primary key values of the master table. The foreign key identifies a column or set of columns in one
                 (referencing) table  that refers to a column or set of columns in another (referenced) table.
                                  Table: Teacher                                 Table: Student

                                                                Primary key                            Foreign key

                        Primary key
                                                                STU_ID     STU_NAME        SUBJECT         T_ID

                           T_ID        TEACH_NAME                 101     Mohit           Accounts          2
                             1           Mr. Hemant               102     Ankur           IP                1

                             2            Mr. Lavish              103     Dev             Maths             3
                             3            Ms. Shreya              104     Rashi           Accounts          2


                   Primary Key: Teacher- T_ID, Student – STU_ID
                   Foreign key: Student- T_ID

                 In Teacher table, the primary key is T_ID. In Student table, the primary key is STU_ID. The relationship between
                 Teacher and Student is made because of the presence of a common field T_ID. So T_ID is a Primary key in
                 table Teacher and a Foreign key in table Student.

                   DATABASE OBJECTS

                 There are different objects that help in executing the purpose of database package.

                   Tables: A table is the basic element of a database in which data is kept in columns (called Fields) and rows
                   (called Records). It acts as a container that stores data pertaining to a single object, subject or purpose.
                   Queries: Queries are commands that are used to define the data structure and also to manipulate the
                   data in the database. It is a call or a request to generate some information from the database. We can use
                   queries to extract specific data from one or more tables based on our needs.

                   Forms: Form provides an interface in a user-specified layout, which lets the user to view the data or enter
                   new data or to modify the existing data records directly in database objects such as tables. Form provides
                   graphical elements such as text boxes, drop-down menus, check boxes and buttons that users can use to
                   add data, edit data and deleted data, etc. By using forms, users can efficiently manage database operations
                   without needing to write queries.
                   Reports:  Report  displays  the  information  in  a  format  as  per  user’s  need.  It  is  used  to  view  and  print
                   information. They provide a concise and meaningful summary of information. Reports can be updated only
                   if the data is changed or added to a table or query based on which it is created.


                                                                      Introduction to Database Management System    213
   210   211   212   213   214   215   216   217   218   219   220