10 Lecture
CS403
Midterm & Final Term Short Notes
Roles in Relationships
Roles in relationships refer to the way tables are related to each other based on their purpose and the way data is organized within them. In a relationship, each table has a role, either as the "parent" or "child" table. The parent table is the
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
In a relationship between two tables, which table holds the primary key? a) Child table b) Parent table c) Both tables hold the primary key Answer: b) Parent table What is the purpose of roles in relationships? a) To determine the size of the tables b) To ensure proper establishment and management of relationships c) To ensure data is organized alphabetically Answer: b) To ensure proper establishment and management of relationships In a customer-order database, which table is the parent table? a) Order table b) Customer table c) Both tables are parent tables Answer: b) Customer table What is the role of the child table in a relationship? a) Hold the primary key b) Hold the foreign key that references the primary key in the parent table c) Both a and b Answer: b) Hold the foreign key that references the primary key in the parent table Which of the following is an example of a role in a relationship? a) Customer ID b) Order date c) Product name Answer: a) Customer ID What does understanding roles in relationships help prevent? a) Data inconsistencies and errors b) Increased performance and scalability c) Better data access patterns Answer: a) Data inconsistencies and errors Which table in a relationship references the primary key in the parent table? a) Child table b) Parent table c) Both tables reference each other Answer: a) Child table Which of the following is a benefit of understanding roles in relationships? a) Improved database security b) Increased data redundancy c) Improved data integrity and consistency Answer: c) Improved data integrity and consistency In a relationship, what is the purpose of the foreign key? a) To reference the primary key in the parent table b) To hold the primary key in the child table c) To hold additional data related to the relationship Answer: a) To reference the primary key in the parent table How does understanding roles in relationships help with database design? a) It helps ensure proper establishment and management of relationships b) It determines the data access patterns c) It helps with database backups and restores Answer: a) It helps ensure proper establishment and management of relationships
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is the role of an entity in a relationship? Answer: An entity can play multiple roles in a relationship, such as the parent entity or the child entity. Define the role of a weak entity in a relationship. Answer: A weak entity is one that depends on another entity (known as the owner entity) for its existence and cannot exist on its own. Its role is to participate in the relationship with the owner entity and to have a partial key to identify it. Explain the difference between a unary and a binary relationship. Answer: A unary relationship is one where an entity is related to itself, while a binary relationship involves two different entities. What is the role of a cardinality constraint in a relationship? Answer: A cardinality constraint defines the number of instances of one entity that can be associated with the instances of another entity in a relationship. What is a composite attribute, and what is its role in a relationship? Answer: A composite attribute is a complex attribute that can be divided into smaller sub-attributes. It can play a role in a relationship by representing the attributes of an entity that participates in the relationship. What is the role of a recursive relationship? Answer: A recursive relationship is one where an entity is related to itself. Its role is to represent a hierarchy or a self-referencing relationship. Define the role of an associative entity in a relationship. Answer: An associative entity is a relationship entity that represents a many-to-many relationship between two other entities. Its role is to simplify the database structure by breaking down a complex relationship into smaller, more manageable relationships. Explain the difference between a mandatory and an optional role in a relationship. Answer: A mandatory role requires an entity to participate in a relationship, while an optional role allows an entity to choose whether or not to participate in a relationship. What is the role of a ternary relationship? Answer: A ternary relationship is one where three different entities are involved in a relationship. Its role is to represent complex relationships that cannot be represented by binary or unary relationships. What is the role of a subtype in a relationship? Answer: A subtype is a specialized entity that inherits attributes and relationships from a parent entity. Its role is to represent specific instances of a more general entity in a relationship.
- One-to-One (1:1): This type of relationship is where one entity is related to only one other entity. For example, one employee has only one office.
- One-to-Many (1:M): In this type of relationship, one entity can be related to multiple instances of another entity. For example, one teacher can have multiple students.
- Many-to-Many (M:N): This type of relationship is where multiple entities can be related to multiple instances of other entities. For example, many students can attend multiple classes.