Week 8 - Logical design (Part 1) Flashcards

(35 cards)

1
Q

What is the default mapping from ER-models to database schemas?

A

By default, every entity and relationship becomes its own table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the default 3-table schema for the Book-Borrow-Member example?

A

Book(book id, authors, title, publisher, year)

Member(member num, last name, first name, address, date of joining)

Borrow(book id, member num, borrow date, due date, return date, fine)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can the Book-Borrow-Member schema be simplified from 3 to 2 tables?

A

Combine the “Borrow” relationship into either “Book” or “Member” tables, removing the separate “Borrow” table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can the original 3-table library schema be optimised into 2 tables?

A

By moving borrowing details into either the Member table or the Book table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the optimised schema if borrowing details are added to the Member table?

A

Book (book id, authors, title, publisher, year)

Member (member num, last name, first name, address, date of joining, book id, borrow date, due date, return date, fine)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the optimised schema if borrowing details are added to the Book table?

A

Book (book id, authors, title, publisher, year, member num, borrow date, due date)

Member (member num, last name, first name, address, date of joining)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the trade-offs of these optimised schemas?

A

Member-focused schema suits libraries tracking individual member borrowing histories.

Book-focused schema suits tracking current borrowing status of books.
(Both have limitations in handling historical or multiple concurrent borrowings.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What issue arises when a member is not borrowing any book in the current design?

A

The borrow-related fields (book id, borrow date, due date, etc.) would be null, leading to inefficient and inconsistent data storage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why is it problematic to include borrow fields directly in the Member table?

A

This design assumes a member can borrow only one book at a time. If the library changes its policy to allow multiple borrowings, the design fails.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When is it safe to merge relationships into a single table in a database design?

A

Only when the multiplicity of the relationship is at most one (1:1).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why is hard-wiring business policies into a database schema a bad idea?

A

Business policies (like borrowing limits) may change, and embedding them into the design reduces flexibility and scalability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What happens in the Book table design when a book is not currently borrowed?

A

The borrow-related fields (member number, borrow date, due date) would be null, leading to sparsity in the table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why can’t fines be handled well in this Book table design?

A

It’s not possible to track both a current borrower and a past member with an outstanding fine for the same book.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why is adding Borrow fields to both Book and Member tables not ideal?

A

It introduces redundancy, which can lead to inconsistencies and complicate updates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the preferred design approach for handling borrowing details and fines effectively?

A

A 3-table design (Book, Member, Borrow) is best, as it cleanly separates entities and supports many-to-many relationships.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a “straight design” in database modeling?

A

A straight design creates a separate table for each entity and each relationship.

17
Q

When can a relationship table be merged with an entity table in a database design?

A

When the relationship has a multiplicity of (0,1) or (1,1) with the entity.

18
Q

What should be considered if a relationship has (0,1) multiplicity and is merged into an entity table?

A

The relationship’s attributes must allow for NULL values, since the relationship might not always exist.

19
Q

What is the main idea behind keeping all three: superclass and subclasses?

A

Each subclass entity inherits the identity and common attributes from the superclass, while adding its own specific attributes.

20
Q

Where are common attributes stored in the superclass-subclass design?

A

In the superclass table, which holds shared fields like name, address, salary, etc.

21
Q

Give an example of how identity and attributes are managed in a superclass-subclass setup.

A

staffid is defined in the Staff (superclass) table and inherited by Tech and Admin (subclass) tables, which store attributes like speciality and role.

22
Q

What are the three possible choices for the table design for hierarchies?

A
  1. Keep A, and omit B and C
  2. Keep B and C, and omit A
  3. Keep all three
23
Q

What does the Staff table represent in the superclass-subclass schema?

A

It is the superclass containing common attributes like staffid, lastname, firstname, joindate, grade, and salary.

24
Q

How are Techstaff and Adminstaff tables related to the Staff table?

A

They are subclasses identified by staffid, inheriting from Staff, and containing additional fields: speciality and department for Techstaff; role and unit for Adminstaff.

25
What happens to subclass tables in the "keep only the superclass" design?
Subclass tables are omitted, and all subclass attributes are added to the superclass table.
26
What is the purpose of the variant attribute in the superclass-only design?
It identifies the subclass type of each entity (e.g., staff_type = 'tech' or 'admin').
27
What is a drawback of storing all subclass attributes in the superclass table?
Fields not relevant to a specific subclass will contain NULL values, leading to sparse and potentially inefficient storage.
28
What is the simplest method for representing hierarchies in database design?
Creating separate tables for both the superclass and each subclass.
29
When is it valid to create tables for only the subclasses?
When the hierarchy annotation is (t, e); identity is assumed from an “imaginary” superclass.
30
What is required when keeping only the superclass and merging subclass attributes?
A variant attribute must be added to indicate the subclass type (e.g., staff_type).
31
What is a potential drawback of the superclass-only design?
It may waste space due to NULL values in subclass-specific fields.
32
What are the first steps when starting a requirements description for a database?
Identify entities, attributes, and relationships between entities.
33
What distinguishes an entity from an attribute in database modeling?
An entity is a "thing" with its own distinct identity and attributes, while an attribute is a property of an entity.
34
What should guide the decision between modeling something as an entity versus a relationship?
Consider if the concept has attributes of its own; if so, it may be better modeled as an entity.
35
Why can identifying relationships be tricky during requirements analysis?
Because some relationships are described using nouns (e.g., “rental”, “payment”), which can also sound like entities.