CIS275 - Chapter 3: Database Design Flashcards

1
Q

An _____ is a high-level representation of data requirements, ignoring implementation details.

A

entity-relationship model

An entity-relationship model guides implementation in a particular database system, such as MySQL.

Example:

  • In an airline reservation system, Passenger and Booking are entities.
  • Holds is a relationship between Passenger and Booking.
  • PassengerNumber, PassengerName, BookingCode, BookingCost are attributes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

An ___ is a person, place, product, concept, or activity.

A

entity

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

A relationship is a statement about two entities.

A

relationship

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

An ______ is a descript­ive property of an entity.

A

attribute

Attribute is used in both entity-relationship and relational models. In the relational model, attribute is a formal term for column. Since entity-relationship attributes typically become relational columns, the meaning of attribute is similar in both models.

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

An _____ diagram is a schematic picture of entities, relationships, and attributes.

A

entity-relationship diagram

ER diagramEntities are drawn as rectangles. Relationships are drawn as lines connecting rectangles. Attributes appear as additional text within an entity rectangle, under the entity name.

Entities and relationships always appear in ER diagrams. Attributes are optional and only appear when additional detail is needed.

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

A ____, also known as a _____ or _____, documents additional detail in text format.

A

glossary

also known as a data dictionary or repository

A glossary includes names, synonyms, and descriptions of entities, relationships, and attributes.

The ER diagram and glossary are complementary and, together, completely describe an entity-relationship model.

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

An _____ is a set of things. Ex: All employees in a company.

A

entity type

Entity, relationship, and attribute types usually become tables, foreign keys, and columns, respectively.

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

A _____ is a statement about entity types. Ex: Employee-Manages-Department.

A

relationship type

Entity, relationship, and attribute types usually become tables, foreign keys, and columns, respectively.

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

An _____ is a set of values. Ex: All employee salaries.

A

attribute type

Entity, relationship, and attribute types usually become tables, foreign keys, and columns, respectively.

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

An _____ is an individual thing. Ex: The employee Sam Snead.

A

entity instance

Entity, relationship, and attribute instances usually become rows, foreign key values, and column values, respectively

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

A _____ is a statement about entity instances. Ex: “Maria Rodriguez manages Sales.”

A

relationship instance

Entity, relationship, and attribute instances usually become rows, foreign key values, and column values, respectively

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

An _____ is an individual value. Ex: The salary $35,000.

A

attribute instance

Entity, relationship, and attribute instances usually become rows, foreign key values, and column values, respectively

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

Complex databases are developed in three phases:

A
  1. Analysis develops an entity-relationship model, capturing data requirements while ignoring implementation details.

Analysis is particularly important for complex databases with many users when documenting requirements is challenging. For small databases with just a few tables and users, analysis is less important and often omitted.

  1. Logical design converts the entity-relationship model into tables, columns, and keys for a particular database system.

Analysis and logical design steps are summarized in the table below. Although these steps are presented in sequence, in practice execution is not always sequential. Often an early step is revisited after a later step is completed.

  1. Physical design adds indexes and specifies how tables are organized on storage media.

Physical design is dependent on specific index and table structures, which vary greatly across relational databases. Physical design is discussed elsewhere in this material.

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

Discover relationships

A
  1. Flight-ArrivesAt-Airport, Flight-DepartsFrom-Airport, and Passenger-Makes-Booking are relationships.
  2. Passenger can be determined from booking. Replace Flight-Has-Passenger with Flight-Includes-Booking.
  3. Further interviews determine the database does not track parts. Part-ShippedTo-Airport is not a relationship.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Discover entities.

A
  1. In an interview with a database user, flight, airport, aircraft, passenger, and booking are entities.
  2. Airplane is another word for aircraft. Traveler is another word for passenger.
  3. Usually, address and credit card have many details and are entities.
  4. Further interviews determine the database does not track parts. Part is not an entity.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Discover attributes

A
  1. Airport code, total cost, and name are attributes of Airport, Booking, and Passenger.
  2. Mileage plan number is an attribute of Passenger or, if additional mileage plan information is tracked, a separate entity.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Attribute names have the form _____, such as EmployeeFirstName:

A

EntityQualifierType

Entity is the name of the entity that the attribute describes. When the entity is obvious, in ER diagrams or informal conversation, QualifierType is sufficient and the entity name can be omitted.

Qualifier describes the meaning of the attribute. Ex: First, Last, and Alternate. Sometimes a qualifier is unnecessary and can be omitted. Ex: StudentNumber.

Type is chosen from a list of standard attribute types such as Name, Number, and Count. Attribute types are not identical to SQL data types. Ex: “Amount” might be an attribute type representing monetary values, implemented as the MONEY data type in SQL. “Count” might be an attribute type representing quantity, implemented as NUMBER in SQL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

In entity-relationship modeling, _____ refers to maxima and minima of relationships and attributes.

A

cardinality

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

The greatest number of instances of one entity that can relate to a single instance of another entity.

A

Relationship maximum

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

_____ is the least number of instances of one entity that can relate to a single instance of another entity.

A

Relationship minimum

A relationship has two minima, one for each of the related entities. Minima are usually specified as zero or one. On ER diagrams, minima are shown after maxima in parentheses. Ex: M(1) or M(0).

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

Entities have an implicit relationship with their attributes, called _____.

A

Entity-Has-Attribute

This relationship, like any other, has maxima and minima.

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

The following terms describe Entity-Has-Attribute maxima:

_____— each entity instance has at most one attribute instance.

A

Singular attribute

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

The following terms describe Entity-Has-Attribute maxima:

_____ — each entity instance can have many attribute instances.

A

Plural attribute

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

The following terms describe Entity-Has-Attribute maxima:

_____ — each attribute instance describes at most one entity instance.

A

Unique attribute

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

The following terms describe Entity-Has-Attribute minima:

_____ — each entity instance has at least one attribute instance.

A

Required attribute

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

The following terms describe Entity-Has-Attribute minima:

_____— each entity instance can have zero attribute instances.

A

Optional attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

A _____ depends on another entity, called the _____.

A

dependent entity

master entity

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

The dependent and master entities are related by a _____.

A

dependency relationship

Ex: Task-BelongsTo-Project is a dependency relationship. On ER diagrams, the dependency relationship is drawn as an arrow pointing to the master entity.

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

An _____ does not depend on any other entity.

A

independent entity

Ex: In a university database, students and departments can be created without reference to any other entity, so Student and Department are independent entities.

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

In the entity-relationship model, dependence means each instance of a dependent entity always relates to an instance of another entity.

Entity-relationship dependence is called _____.

A

existence dependence

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

In the relational model, dependence means each value of a column relates to at most one value of another column.

Relational dependence is called _____.

A

functional dependence

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

All exams belong to a course. A course must exist before course exams are created. When a course is deleted, course exams are also deleted. Courses are always part of an academic department. We set up academic departments in the database before we add courses.

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

UML

A

Unified Modeling Language

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

IDEF1X

A

Information DEFinition version 1X

55
Q
A
56
Q
A
57
Q
A

Expected:

Orchard is independent

Wholesaler is independent

Order depends on Orchard and Wholesaler

Deleting an Order, or deleting a Wholesaler, does not cause an Orchard to be deleted, so Orchard is independent.

Deleting an Order, or deleting an Orchard, does not cause a Wholesaler to be deleted, so Wholesaler is independent.

An Order is cancelled when either the Orchard or the Wholesaler goes out of business, so Order is dependent on both Orchard and Wholesaler.

58
Q
A

Band is independent

Arena is independent

Concert depends on Band and Arena

Deleting an Arena, or deleting a Concert, does not delete the Band, so Band is independent.

Deleting a Band, or deleting a Concert, does not delete the Arena, so Arena is independent.

If a band breaks up, the rest of the concerts on its tour are cancelled. If an arena is no longer available, the concerts scheduled for that Arena are cancelled. So, concert is dependent on both Arena and Band, because if the Arena or Band of a concert is deleted, the Concert is deleted too.

59
Q
A

OfficeBuilding is independent

OfficeSuite depends on OfficeBuilding

MeetingRoom depends on OfficeSuite

Deleting a MeetingRoom or OfficeSuite does not cause the building to be deleted, so OfficeBuilding is independent.

Office suites of a building are deleted when the building is destroyed, so OfficeSuite is dependent on OfficeBuilding.

Meeting rooms of an office suite are deleted when the office suite is eliminated, so MeetingRoom is dependent on OfficeSuite.

60
Q
A

SchoolDistrict is independent

SchoolBoard depends on SchoolDistrict

Person is independent

Deleting a SchoolBoard, or deleting a Person does not cause the SchoolDistrict to be deleted, so SchoolDistrict is independent.

A SchoolBoard is deleted when the SchoolDistrict is deleted, so SchoolBoard depends on SchoolDistrict.

Deleting a SchoolDistrict, or deleting a SchoolBoard, does not cause the Person to be deleted, so Person is independent. (A Person may move to another SchoolBoard.)

61
Q
A

TrackMeet is independent

Event depends on TrackMeet

Heat depends on Event

Deleting an Event, or deleting a Heat, does not cause the TrackMeet to be deleted, so TrackMeet is independent.

Events of a TrackMeet are deleted when the TrackMeet is deleted, so Event is dependent on TrackMeet.

Heats of an Event are deleted when the Event is deleted, so Heat is dependent on Event.

62
Q
A

Player is independent

Team is independent

Contract depends on Player and Team

Deleting a Contract, or deleting a Team, does not delete the Player, so Player is independent. (The Player may move to another Team.)

Deleting a Contract, or deleting a Player, does not delete the Team, so Team is independent. A Contract is deleted when a Player leaves a Team, or when the Team is disbanded, so Contract is dependent on both Player and Team.

63
Q

a set of entity instances

A

entity type

64
Q

A _____ is a subset of another entity type, called the _____.

A

subtype entity

supertype entity

Ex: Managers are a subset of employees, so Manager is a subtype entity of the Employee supertype entity. On ER diagrams, subtype entities are drawn within the supertype.

65
Q
A
  1. Vehicle supertype has ElectricVehicle and GasVehicle subtypes.
  2. Number of passengers and number of wheels apply to both electric and gas vehicles.
  3. Battery capacity applies to electric vehicles only.
  4. Number of cylinders applies to gas vehicles only.
66
Q

The dependency relationship from subtype to supertype is called an _____.

A

IsA relationship

Ex: Manager-IsAn-Employee.

  1. Subtype entities have an IsA dependency relationship to the supertype.
  2. IsA relationships are assumed and usually not shown in an ER diagram.
67
Q
A
68
Q

_____ are entities that have many common attributes and relationships.

A

Similar entities

  1. Student, Faculty, and Administrator are similar entities with common attributes FullName, SocialSecurityNumber, and EmailAddress.
  2. Common attributes move to a new supertype entity called Person.
  3. Subtype-specific attributes remain attributes of each subtype.
69
Q

An entity with many optional attributes often becomes a supertype entity. Optional attributes move to new subtype entities. Required attributes remain with the supertype entity.

A
  1. Vehicle has required attribute ManufacturerCode and optional attributes BatteryCapacity and ChargingType.
  2. Optional attributes become the new subtype entity ElectricVehicle.
70
Q
A
71
Q

A _____ of a supertype entity is a group of mutually exclusive subtype entities.

A

partition

Subtype entities in a partition cannot share common instances.

Ex: Undergraduate and graduate students are mutually exclusive subsets of students. UndergraduateStudent and GraduateStudent partition the supertype entity Student.

  1. CreditCard, DebitCard, and GiftCard partition Card.
  2. CreditType is partition attribute. Values are “Credit”, “Debit”, “Gift”.
  3. Visa, MasterCard, and Discover are another partition. Partition attribute is SponsorCode.
  4. Card has two partitions.
72
Q

Each partition corresponds to a _____ of the supertype entity.

A

partition attribute

The partition attribute indicates which subtype entity each instance belongs to.

Ex: StatusCode is a partition attribute of the Student supertype entity. Code ‘U’ indicates the student is an undergraduate, and code ‘G’ indicates the student is a graduate.

A supertype entity can have zero, one, or many partitions.

73
Q
A
74
Q

Creating supertype and subtype entities is the last of four analysis steps:

A
  1. Discover entities, relationships, and attributes
  2. Determine cardinality
  3. Distinguish independent and dependent entities
  4. Create supertype and subtype entities
75
Q
A
76
Q
A

PublisherName is an attribute of a supertype entity

Format is an attribute of a subtype entity

Each resource has a publisher name, so PublisherName is an attribute of the supertype entity Resource.

Only eBooks have a format, so Format is an attribute of the subtype entity EBook.

77
Q
A
  1. PartName is unique and required, but also complex and meaningful. PartName is not a good primary key.
  2. PartCode and PartSize are not individually unique; however, the composite (PartCode, PartSize) is unique, as well as required and simple.
  3. PartSize is meaningful and might change due to data entry errors or part redesign. (PartCode, PartSize) is not a good primary key.
  4. The database designer creates a new PartNumber column for internal database use. PartNumber is unique, required, stable, simple, and meaningless, and therefore a good primary key.
78
Q
A
79
Q
A
80
Q
A
81
Q

An independent entity becomes an _____.

A

independent table

82
Q

An _____ is a single-column primary key created by the database designer when no suitable single-column or composite primary key exists.

A

artificial key

Usually artificial key values are integers, generated automatically by the database as new rows are inserted to the table. Artificial keys are stable, simple, and meaningless.

83
Q
A
  1. Passenger is an independent table. Each attribute becomes a column in the initial design.
  2. FullName is not unique and cannot be the primary key.
  3. Not all passengers have a mileage plan number. MileagePlanNumber is not required and cannot be the primary key.
  4. Every passenger must provide identification, such as a driver’s license or passport. The composite (IdentificationNumber, IdentificationType) is unique.
  5. Passengers may provide different identification in the future, so (IdentificationNumber, IdentificationType) is unstable and a poor primary key.
  6. Since no suitable primary key exists, a database designer creates an artificial key PassengerNumber.
84
Q
A
85
Q

A subtype entity becomes a _____ and is implemented as follows:

The primary key is identical to the supertype primary key.

The primary key is also a foreign key that references the supertype primary key.

A

subtype table

86
Q
A
  1. MileagePlanMember is a subtype of Passenger.
  2. The subtype’s primary key PassengerNumber is identical to the supertype’s primary key.
  3. The primary key of a subtype is also the foreign key referencing the supertype.
87
Q
A
88
Q

A dependent entity becomes a _____.

A

dependent table

The primary key is usually composite and includes:

A foreign key that references the master table primary key.

Another column that makes the composite primary key unique. If no suitable column is available in the dependent table, an artificial column can be created.

89
Q
A
  1. Task depends on Project. ProjectCode is the primary key of Project.
  2. Task’s primary key includes Project’s primary key and an additional column, necessary for uniqueness.
  3. ProjectCode in Task table is also a foreign key.
90
Q
A
  1. Booking depends on Flight and Passenger.
  2. Booking’s primary key includes Flight and Passenger’s primary keys. In this case, no additional columns are necessary for uniqueness.
  3. FlightCode and PassengerNumber in Booking primary key are also foreign keys.
91
Q
A
92
Q
A
93
Q
A

Expected: Required

CollegeName could not be a good primary key.

CollegeName is:

Required. Every college must have a name. However, CollegeName is: Not unique. More than one college can have the same name. Not stable. A college may be renamed. Not simple. A college can have a name that is too long to type easily in a WHERE clause. Not meaningless. A college name could reflect which statewide system it is part of or what its specialty is. Therefore, CollegeName could not be a good primary key.

1

2

94
Q
A
95
Q
A
96
Q
A
97
Q
A
98
Q
A

Expected: (DivisionNumber, DepartmentID)

Department is dependent on Division, so the primary key of Department is a composite that includes the primary key of Division.

DepartmentName can’t be used in primary key because DepartmentName is not stable. (A Department may be renamed.)

The composite (DivisionNumber, DepartmentID) uniquely identifies a department and is a good primary key. No additional information is needed in the primary key.

99
Q
A

Expected: EmployeeID

Manager is a subtype of Employee. EmployeeID is a sufficient primary key for the Manager table, because it uniquely identifies a row in the Manager table: for every row in the Manager table there is a corresponding row in the Employee table. There is no need for additional information in the primary key of the Employee table.

100
Q
A

Expected: (ShipperID, CustomerID, ShipmentNumber)

Shipment is dependent on both Shipper and Customer. Therefore, the primary key of Shipment must be a composite that includes ShipperID and CustomerID.

Because a shipper accepts many shipments from a customer, the primary key of Shipment must include some additional distinguishing information.

ShipmentDate is not sufficient because a Customer might deliver multiple Shipments to a Shipper on the same date.

So, (ShipperID, CustomerID, ShipmentNumber) would be the primary key for Shipment.

101
Q
A
102
Q
A
  1. Flight-ArrivesAt-Airport is a many-one relationship.
  2. The Airport entity becomes a table with primary key AirportCode.
  3. ArrivesAt becomes the foreign key ArrivalAirportCode on the ‘many’ side, referencing the primary key AirportCode on the ‘one’ side.
103
Q
A
104
Q
A
  1. Airport-IsLocatedAt-Address is a one-one relationship.
  2. The Address entity becomes a table with primary key AddressID.
  3. Address contains addresses of people as well as airports, so Address has more rows than Airport. The foreign key LocationAddressID goes in the table with fewer rows.
105
Q

A many-many relationship becomes a new table:

The new table contains two foreign keys, referring to the primary keys of the related tables.

The primary key of the new table is the composite of the two foreign keys.

The new table is dependent on the related tables, so primary key cascade and foreign key restrict rules are specified.

The new table name consists of the related table names with an optional qualifier in between. The qualifier is derived from the relationship name and clarifies the meaning of the table.

In the figure below, the many-many relationship Airline-Schedules-Flight becomes the new table AirlineFlight. The primary keys from Airline and Flight become foreign keys in AirlineFlight, and the composite key (AirlineCode, FlightNumber) becomes AirlineFlight’s primary key.

A

A many-many relationship becomes a new table:

The new table contains two foreign keys, referring to the primary keys of the related tables.

The primary key of the new table is the composite of the two foreign keys.

The new table is dependent on the related tables, so primary key cascade and foreign key restrict rules are specified.

The new table name consists of the related table names with an optional qualifier in between. The qualifier is derived from the relationship name and clarifies the meaning of the table.

In the figure below, the many-many relationship Airline-Schedules-Flight becomes the new table AirlineFlight. The primary keys from Airline and Flight become foreign keys in AirlineFlight, and the composite key (AirlineCode, FlightNumber) becomes AirlineFlight’s primary key.

106
Q
A
107
Q
A
108
Q
A

Expected: Campus, UniversityID, No

The foreign key goes in the Campus table, the ‘many’ side of the relationship.

The foreign key refers to UniversityID, the primary key on the ‘one’ side. NULLs are not allowed in the UniversityID column of the Campus table, because the minimum on the University side is 1.

109
Q
A

Expected: Citizen, StateCode, Yes

The foreign key goes in the Citizen table, the ‘many’ side of the relationship. The foreign key refers to StateCode, the primary key on the ‘one’ side. NULLs are allowed in the StateCode column of the Citizen table, because the minimum on the State side is 0.

110
Q
A

Expected: Book, CardNumber, Yes

The foreign key goes in the Book table, the ‘many’ side of the relationship. The foreign key refers to CardNumber, the primary key on the ‘one’ side. NULLs are allowed in the CardNumber column of the Book table, because the minimum on the User side is 0.

111
Q
A

Expected: CongressionalDistrict SocialSecurityNumber

No: the minimum on the Representative side is 1.

The foreign key usually goes in the table with fewer rows. The CongressionalDistrict table will usually have fewer rows than the Representative table, so the foreign key goes in the CongressionalDistrict table.

The foreign key in the CongressionalDistrict table refers to SocialSecurityNumber, the primary key of the other table.

NULLs are not allowed in the SocialSecurityNumber column of the CongressionalDistrict table, because the minimum on the Representative side is 1.

112
Q
A

Expected:

State

SocialSecurityNumber

Yes: the minimum on the Person side is 0.

The foreign key usually goes in the table with fewer rows. The State table will usually have fewer rows than the Person table, so the foreign key goes in the State table.

The foreign key in the State table refers to SocialSecurityNumber, the primary key of the other table.

NULLs are allowed in the SocialSecurityNumber column of the State table, because the minimum on the Person side is 0.

113
Q
A

Expected: DockSlip Registration Yes: the minimum on the Sailboat side is 0. The foreign key usually goes in the table with fewer rows. The DockSlip table will usually have fewer rows than the Sailboat table, so the foreign key goes in the DockSlip table.

The foreign key in the DockSlip table refers to Registration, the primary key of the other table.

NULLs are allowed in the Registration column of the DockSlip table, because the minimum on the Sailboat side is 0.

114
Q
A

Expected: Country FlagID

No: the minimum on the Flag side is 1.

The foreign key usually goes in the table with fewer rows. The Country table will usually have fewer rows than the Flag table, so the foreign key goes in the Country table.

The foreign key in the Country table refers to FlagID, the primary key of the other table.

NULLs are not allowed in the FlagID column of the Country table, because the minimum on the Flag side is 1.

115
Q
A

Expected: Mailbox ApartmentNumber

Yes: the minimum on the Apartment side is 0.

The foreign key usually goes in the table with fewer rows. The Mailbox table will usually have fewer rows than the Apartment table, so the foreign key goes in the Mailbox table.

The foreign key in the Mailbox table refers to ApartmentNumber, the primary key of the other table.

NULLs are allowed in the ApartmentNumber column of the Mailbox table, because the minimum on the Apartment side is 0.

116
Q
A

Expected: both EmployeeID and ProjectID (ProjectID, EmployeeID) and (EmployeeID, ProjectID)

The new table contains foreign keys referring to the primary keys of the related tables, so both EmployeeID and ProjectID.

The primary key of the new table is a composite of the two foreign keys. The order within the composite does not matter, so (EmployeeID, ProjectID) or (ProjectID, EmployeeID).

117
Q
A

both PartID and ModelNumber

(ModelNumber, PartID) and (PartID, ModelNumber)

The new table contains foreign keys referring to the primary keys of the related tables, so both PartID and ModelNumber.

The primary key of the new table is a composite of the two foreign keys. The order within the composite does not matter, so (PartID, ModelNumber) or (ModelNumber, PartID).

118
Q
A
  1. Each flight offers several kinds of in-flight meals. MealType is a plural attribute of Flight.
  2. The plural attribute MealType moves to the new table FlightMealType. The foreign key FlightNumber references the initial table.
  3. The primary key of the new table is the composite of plural attribute MealType and foreign key FlightNumber.
  4. At most three meal types are offered on each flight, so MealType has a small, fixed maximum.
  5. Plural attributes with a small, fixed maximum can be implemented as multiple columns in the same table. MealType becomes three different columns.
119
Q
A
120
Q
A
  1. The glossary specifies data types CHAR(4) and VARCHAR(30) for attributed types Code and Name, respectively.
  2. In the Airport entity, two attributes have attribute type Code and two have attribute type Name.
  3. In an SQL CREATE TABLE statement, Attribute type Code is implemented as CHAR(4). Attribute type Name is implemented as VARCHAR(30).
121
Q
A
122
Q
A
123
Q
A
124
Q
A
125
Q

_____ eliminates redundancy by decomposing a table into two or more tables in higher normal form.

A

Normalization

Ex: A table in first normal form might be replaced by two tables in third normal form. In principle, normalization decomposes tables to any higher normal form.

126
Q

Column A _____ on column B when each B value is related to at most one A value. A and B may be simple or composite columns. In a _____ table, if column A depends on column B, then B must be unique.

A

depends

Boyce-Codd normal form

Normalizing a table to Boyce-Codd normal form involves three steps:

  1. List all unique columns. Unique columns may be simple or composite. In composite columns, remove any columns that are not necessary for uniqueness. The primary key is unique and therefore always on this list.
  2. Identify dependencies on non-unique columns. Non-unique columns are either external to all unique columns or contained within a composite unique column.
  3. Eliminate dependencies on non-unique columns. If column A depends on a non-unique column B, A is removed from the original table. A new table is created containing A and B. B is a primary key in the new table and a foreign key in the original table.
127
Q
A
  1. The Registration table lists student registration for courses by term.
  2. RegistrationCode is a unique column.
  3. (StudentID, CourseNumber, Term) is a composite unique column.
  4. CourseName and Credit depend on CourseNumber, which is not unique. Registration is not in Boyce-Codd normal form.
  5. Redundancy is eliminated by removing CourseName and Credit. RegistrationNew is in Boyce-Codd normal form.
  6. CourseNumber, CourseName, and Credit are tracked in a new Course table.
  7. All dependencies in Course are on a unique column. Course is in Boyce-Codd normal form.
128
Q
A
129
Q

_____ means intentionally introducing redundancy by merging tables.

A

Denormalization

Denormalization eliminates join queries and therefore improves query performance. Denormalization results in first and second normal form tables and should be applied selectively and cautiously.

In the figure below, the Booking, Passenger, and Fare tables are denormalized into a single Booking table. The red highlight indicates redundancy in the denormalized table.

130
Q
A
131
Q
A
132
Q

Analysis steps.

  1. Discover entities, relationships, and attributes
  2. Determine cardinality
  3. Distinguish independent and dependent entities
  4. Create supertype and subtype entities

Logical design steps.

  1. Implement entities
  2. Implement relationships
  3. Implement attributes
  4. Normalize tables
A

Discover entities, relationships, and attributes.

1A. Identify entities, relationships, and attributes in interviews.

1B. Draw ER diagram.

1C. List standard attribute types in glossary.

1D. Document names, synonyms, and descriptions in glossary.

Determine cardinality.

2A. Determine relationship maxima and minima.

2B. Determine attribute maxima and minima.

2D. Document cardinality in glossary and, optionally, on ER diagram.

133
Q

Distinguish independent and dependent entities.

3A. Identify independent and dependent entities.

3B. Determine the dependency relationship for each dependent entity.

3C. Document dependent entities and dependency relationships
in glossary and ER diagram.

Create supertype and subtype entities.

4A. Identify supertype and subtype entities.

4B. Replace similar entities and optional attributes with supertype and subtype entities.

4C. Identify partitions and partition attributes.

4D. Document supertypes, subtypes, and partitions in glossary and ER diagram.

A

Implement entities.

5A.Implement independent entities as tables.

5B. Create an artificial key when no suitable primary key exists.

5C. Implement subtype entities as tables.

5D. Implement dependent entities as tables.

5E. Specify cascade and restrict actions for dependency relationships.

Implement relationships.

6A. Implement many-one relationships as foreign key on ‘many’ side.

6B. Implement one-one relationships as foreign key in table with fewer rows.

6C. Implement many-many relationships as new dependent tables.

6D. Specify cascade and restrict rules on foreign keys that implement dependency relationships.

134
Q

Implement attributes.

7A. Implement plural attributes as new dependent tables.

7B. Specify cascade and restrict rules on new foreign keys in dependent tables.

7C. Specify column data types corresponding to attribute types.

7D. Enforce relationship and attribute cardinality with UNIQUE and NOT NULL keywords.

A

Normalize tables.

8A. Identify dependencies on non-unique columns.

8B. Eliminate redundancy by decomposing tables.

8C. Consider denormalizing tables in reporting databases.