Page 99 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 99

Database Management Systems/Managing Database




                    Notes          Here, we can note that, one employee can work in many departments, or, one department can
                                   have many employees. This can also be illustrated with the following Figure 6.4:

                                                                     Figure  6.4



                                                                            1/1/91
                                                                                                    51
                                                123 - 22 -3666              3/3/93
                                                231 - 31 5368               2/2/92
                                                                                                    56
                                               131 - 24 -3650               3/1/92

                                               223 - 32 -6316                                       62
                                                                            3/1/92




                                   Here, employee 231-31-5368 has worked in Department 51 since, 3/3/93 and in Department 56
                                   since 2/2/92. Thus one department can have many employees.
                                   But, if we want to have only one employee in a department, then it is an example of a Key
                                   Constraint.


                                          Example: Consider another relationship Manages between employees and department
                                   entities as in the following figure.
                                                                     Figure  6.5


                                                    ename              Since            dname



                                              eno          salary                 did          budget





                                              Employees              Manages              Department


                                   Here, each department can have only one manager. The restriction that each department can
                                   have only one manager is an example is an example of a Key Constraints This restriction is
                                   indicated in the above ER diagram by using an arrow from department to manages, such that a
                                   department can have only one manager. Therefore, as there is no arrow from employees entity
                                   to manages relationship, we can say that,  many employees  or one employee can manage
                                   department. But, as there is an arrow from department entity to manages relationship, we say
                                   that, the departments is managed by only one employee or there is only one manager for
                                   department(s), indicating many-to-one relationship.

                                   Participation Constraint

                                   The key constraint and its figure in the previous unit on manages relationship tells us that every
                                   department has one manager. This requirement is an example of a participation constraints i.e.,



          92                                LOVELY PROFESSIONAL UNIVERSITY
   94   95   96   97   98   99   100   101   102   103   104