Assignment 02
Assignment 02
Proposed Relations:
1. Employee:
2. Assistant:
3. Professor:
Explanation:
• The Employee relation stores the common attributes for all employees.
• The Assistant and Professor relations store the specific attributes for each subtype.
• The empID attribute is used to establish the relationship between the subtypes and the
supertype. It acts as both the primary key in the subtype relations and a foreign key referencing
the Employee relation.
1. Single Table:
2. Separate Tables:
o Advantages: Efficient for queries involving specific subtypes, avoids null values.
o Disadvantages: More complex to implement, requires joins for queries involving all
subtypes.
4. Inheritance View:
o Advantages: Provides a logical view of the hierarchy without physical changes to the
data.
• Query patterns: If most queries involve specific subtypes, separate tables or subtype table with
discriminator column might be better.
• Update frequency: If updates to subtypes are frequent, separate tables can reduce the impact
on other subtypes.
• Database system capabilities: Inheritance views may not be supported by all systems.
In the given example, the separate tables approach seems suitable as it avoids null values and is efficient
for queries involving specific subtypes. However, the choice might differ based on specific application
requirements and database system capabilities.
Question No 3
Key Entities:
Relationships:
• Customer borrows Loan: One-to-many relationship. A customer can borrow multiple loans, but
a loan can only be borrowed by one customer.
• Customer owns Account: One-to-many relationship. A customer can own multiple accounts, but
an account can only be owned by one customer.
• Loan pays Payment: One-to-many relationship. A loan can have multiple payments, but a
payment can only be associated with one loan.
Proposed Relations
1. Customer:
2. Loan:
3. Payment:
4. Account:
5. SavingsAccount:
6. CheckingAccount:
Explanation:
• The Customer, Loan, and Payment relations are straightforward, representing the core entities
and their attributes.
• The Account relation stores common attributes for both savings and checking accounts.
• The SavingsAccount and CheckingAccount relations inherit from the Account relation and add
their specific attributes.
Note:
• The assumption is made that a payment is associated with only one loan. If a payment can be
associated with multiple loans, the Payment relation would need to have a foreign key to the
Loan relation as a composite primary key.
• The assumption is made that only a few null values are expected, so extra relations to handle
null values are not created.