How to resolve many to many relationship?

Answer Posted / balaji

An example of a many-to-many relationship in the greenhouse
plant application is between the Plant and Additive
entities. Each plant may be treated with one or more
Additives. Each Additive may be given to one or more Plants.
The ERD for this relationship is shown below.

Many-to-many relationships cannot be directly converted into
database tables and relationships. This is a restriction of
the database systems, not of the application. The
development team has to resolve the many-to-many
relationship before it can continue with the database
development. If you identify a many-to-many relationship in
your analysis meeting, you should try to resolve it in the
meeting. The participants can usually find a fitting entity
to provide the resolution.

To resolve a many-to-many relationship means to convert it
into two one-to-many, many-to-one relationships. A new
entity comes between the two original entities, and this new
entity is referred to as an intersection entity. It allows
for every possible matched occurrence of the two entities.
Sometimes the intersection entity represents a point or
passage in time.

The Plant-Additive many-to-many relationship above is
resolved in the following ERD diagram:

With these new relationships, Plant is now related to
Treatment. Each Plant may be given one or more Treatments.
Each Treatment must be given to one and only one Plant.
Additive is also related to Treatment. Each Additive may be
used in one or more Treatments. Each Treatment must be
comprised of one and only one Additive. With these two new
relationships, Treatment cannot exist without Plant and
Additive. Treatment can occur multiple times, once for each
treatment of a plant additive. To keep each Treatment
unique, a new attribute is defined. Treatment now has
application date and time attributes. They are the unique
identifiers or the primary key of Treatment. Other
attributes of Treatment are quantity and potency of the
additive.

Is This Answer Correct ?    41 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give any criteria when you use an abstract class and an interface?

704


What is the syntax of object oriented method call?

709


Can you define OOP and principles of OOP?

709


What are abstract classes?

756


What is serialization? How do we implement serialization actually?

653






What is diamond inheritance problem? How java 8 solves this problem?

827


What is the difference between an abstract class and interface in java?

744


Explain what is object oriented programming language?

743


State two differences between an object and a class.

757


What is meant by “abstract interface”?

752


Can an interface inherit from another interface?

717


Why is message passing between the objects important?

722


Does java support multiple inheritance? if not, what is the solution?

695


Why is C not an OOP language?

730


Why use oops?

678