ER Diagrams and the Relational Model Flashcards
1
Q
Entities
A
- “Things”
- Represented using rectangles
2
Q
Attributes
A
- Describe entities
- Represented as ovals connected by a line to the entity
- Double ovals for attributes with multiple possible values
3
Q
Key
A
- A collection of attributes that can uniquely identify each entity in an entity set
4
Q
Candidate Key
A
- A minimal collection of attributes that is a key
5
Q
Primary Key
A
- Chosen from the set of possible candidate keys
- Underlined in the ER diagram
6
Q
Relationships between Entities
A
- Represented using diamonds that are connected to the relevant entity sets
- The Key is the union of the primary keys of the related entities
- The resulting key may not be minimal
7
Q
Role Indicators
A
- Labels on the lines to distinguish the roles of the entities in the relationship
8
Q
Cardinality Constraint
A
- Limits the number of times a given entity can appear in a relationship set
- An entity in A having “at most one” entity in B is denoted by an arrow going into entity in B
9
Q
Many-to-One Relationship
A
- In a many-to-one relationship from A to B, an entity in A can be related to at most one entity in B, and an entity in B can be related to 0+ entities in A
10
Q
One-to-One Relationship
A
- An entity in A can be related to at most one entity in B, and an entity in B can be related to at most one entity in A
11
Q
Many-to-Many Relationship
A
- An entity in A can be related to 0+ entities in B, and an entity in B can be related to 0+ entities in A
12
Q
Participation Constraint
A
- An entity in A having “at least one” entity in B is denoted by a thick line going from the entity in A
13
Q
Relational Terminology
A
- Table = relation
- Row = tuple
- Column = attribute
14
Q
Relational Schema
A
- Consists of the name of the relation, the name of the attributes, and the domains of the attributes
- The relational database schema is made up of the schemas of all of the relations in the database
15
Q
Special Case: Many-to-One Relationship Sets
A
- Eliminate the relation for the relationship set
- Combine the entity and attributes on the “one” end into the “many” end
16
Q
Uniqueness Constraint
A
- No two rows will have the same primary key
17
Q
Special Case: One-to-One Relationship Sets
A
- The relationship can be captured in the relation used for either of the entity sets
18
Q
Primary Keys in Relationship Sets
A
- Many-to-many: the union of the primary keys
- One-to-one: the primary key of either set
- Many-to-one: the primary key of the entity set at the “many” end
19
Q
Foreign Key
A
- An attribute in a relation that takes on values from the primary key attribute(s) of another relation
20
Q
First Normal Form (1NF)
A
- All data is in the form of tables (relations)
21
Q
Second Normal Form (2NF)
A
- An attribute that is not part of a key that depends on a subset of a key should be separated into a new table
22
Q
Third Normal Form (3NF)
A
- Separate foreign keys dependent on foreign keys