Database-MySQL [3i Infotech Placement]: Sample Questions 16 - 16 of 162

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 16

Edit

Describe in Detail

Essay▾

What is Relationship type?

Explanation

  • A Relationship Type defines a relationship set among entities of certain entity types.
  • There are three types of relationship types
    • One-to-one
    • One-to-many
    • Many-to-many

One-to-one

  • One-to-one relationships have 1 specified for both cardinalities, and do not seem to arise very often.
  • To illustrate a one-to-one, we require very specific business rules. Suppose we have People and Vehicles.
  • Assume that we are only concerned with the current driver of a vehicle, and that we are only concerned with the current vehicle that a driver is operating.
  • Then, we have a one-to-one relationship between Vehicle and Person (note the role shown for Person in this relationship) :
Understanding of One-To-One Relationship

One-to-many

  • This type of relationship has 1 and n specified for cardinalities, and is very common in database designs.
  • Suppose we have customers and orders and the business rules:
    • An order is related to one customer, and
    • A customer can have any number (zero or more) of orders.
One-To-Many Relationship

Many-to-many

  • Many-to-many relationships have “many” specified for both cardinalities, and are also very common.
  • However, should you examine a data model in some business, there is a good chance you will not see any many-to-many relationships on the diagram.
  • In those cases, the data modeler has resolved the many-to-many relationships into two one-tomany relationships.
  • Suppose we are interested in courses and students and the fact that students register for courses: Any student may take several courses, A course may be taken by several students.
  • This situation is represented with a many-to-many relationship between Course and Student:
Many-To-Many Relationship

Developed by: