Podcast
Questions and Answers
Which of the following is NOT a requirement for a table to qualify as a relation?
Which of the following is NOT a requirement for a table to qualify as a relation?
- Attributes (columns) must have unique names.
- The order of the columns must be relevant. (correct)
- All rows must be unique.
- Every attribute value must be atomic.
In the context of database design, what do relations (tables) correspond to in the E-R model?
In the context of database design, what do relations (tables) correspond to in the E-R model?
- Entity instances
- Attributes
- Entity types and many-to-many relationship types (correct)
- Constraints
Why are primary keys important in relational databases?
Why are primary keys important in relational databases?
- They can be simple or composite.
- They enable a dependent relation to refer to its parent relation.
- They speed up the response to user queries.
- They guarantee that all rows in a relation are unique. (correct)
Which of the following scenarios demonstrates a violation of the entity integrity constraint?
Which of the following scenarios demonstrates a violation of the entity integrity constraint?
What does referential integrity ensure in the context of relational databases?
What does referential integrity ensure in the context of relational databases?
When transforming EER diagrams into relations, how are composite attributes handled?
When transforming EER diagrams into relations, how are composite attributes handled?
When transforming EER diagrams into relations, what happens to multivalued attributes?
When transforming EER diagrams into relations, what happens to multivalued attributes?
When mapping a weak entity in an EER diagram to relations, what is the primary key of the new relation composed of?
When mapping a weak entity in an EER diagram to relations, what is the primary key of the new relation composed of?
In the context of mapping binary relationships, how is a many-to-many relationship handled?
In the context of mapping binary relationships, how is a many-to-many relationship handled?
In a one-to-one binary relationship, if one side is mandatory and the other is optional, where does the primary key go as a foreign key?
In a one-to-one binary relationship, if one side is mandatory and the other is optional, where does the primary key go as a foreign key?
What is the default primary key for an associative entity when an identifier is not assigned?
What is the default primary key for an associative entity when an identifier is not assigned?
In mapping unary relationships, what indicates a recursive foreign key?
In mapping unary relationships, what indicates a recursive foreign key?
When mapping ternary relationships, what attributes are included in the associative entity?
When mapping ternary relationships, what attributes are included in the associative entity?
When mapping supertype/subtype relationships, where do supertype attributes, including the subtype discriminator, go?
When mapping supertype/subtype relationships, where do supertype attributes, including the subtype discriminator, go?
What is the primary goal of data normalization?
What is the primary goal of data normalization?
A table should not pertain to more than one:
A table should not pertain to more than one:
What is a functional dependency in the context of database design?
What is a functional dependency in the context of database design?
What is a candidate key?
What is a candidate key?
What is the problem with a relation that is not in First Normal Form (1NF)?
What is the problem with a relation that is not in First Normal Form (1NF)?
What condition must be met for a relation to be in Second Normal Form (2NF)?
What condition must be met for a relation to be in Second Normal Form (2NF)?
What is the key characteristic of a relation in Third Normal Form (3NF)?
What is the key characteristic of a relation in Third Normal Form (3NF)?
Which normal form is generally considered sufficient for most practical database designs?
Which normal form is generally considered sufficient for most practical database designs?
Among the issues with merging entities from different ER models, which describes attributes with the same name but different meanings?
Among the issues with merging entities from different ER models, which describes attributes with the same name but different meanings?
What are enterprise keys and how do they relate to a database?
What are enterprise keys and how do they relate to a database?
What does data manipulation refers to, within the components of the relational model?
What does data manipulation refers to, within the components of the relational model?
How are domain constraints enforced in a database?
How are domain constraints enforced in a database?
Which of the following delete rules ensures that the 'parent' side cannot be deleted if related rows exist in the 'dependent' side?
Which of the following delete rules ensures that the 'parent' side cannot be deleted if related rows exist in the 'dependent' side?
In database design, what does the term 'relation' refer to?
In database design, what does the term 'relation' refer to?
In the context of database normalization, which of the following describes the process of decomposing relations with anomalies to produce smaller, well-structured relations?
In the context of database normalization, which of the following describes the process of decomposing relations with anomalies to produce smaller, well-structured relations?
Which of the following constraints ensures that a foreign key value must match an existing primary key value in another table?
Which of the following constraints ensures that a foreign key value must match an existing primary key value in another table?
In the context of transforming EER diagrams to relational schemas, what is the impact of a multivalued attribute?
In the context of transforming EER diagrams to relational schemas, what is the impact of a multivalued attribute?
Which of the options below represents the correct transformation of a composite attribute from an EER diagram into a relational schema?
Which of the options below represents the correct transformation of a composite attribute from an EER diagram into a relational schema?
When mapping a Many-to-Many binary relationship from an EER diagram to relations, why is a new relation created?
When mapping a Many-to-Many binary relationship from an EER diagram to relations, why is a new relation created?
Which consideration is most important when deciding where to place a foreign key in a 1:1 binary relationship?
Which consideration is most important when deciding where to place a foreign key in a 1:1 binary relationship?
In the context of mapping associative entities, what is a key difference between an entity with an assigned identifier versus one without?
In the context of mapping associative entities, what is a key difference between an entity with an assigned identifier versus one without?
In mapping unary relationships, what does a recursive foreign key accomplish?
In mapping unary relationships, what does a recursive foreign key accomplish?
When creating relations from a supertype/subtype structure, what does it mean to say that these are implemented as one-to-one relationships?
When creating relations from a supertype/subtype structure, what does it mean to say that these are implemented as one-to-one relationships?
What is the main objective for View Integration when approaching relational databases?
What is the main objective for View Integration when approaching relational databases?
Which of the following describes transitive dependency, and how is it resolved?
Which of the following describes transitive dependency, and how is it resolved?
Which of the following is implemented with foreign key to primary references?
Which of the following is implemented with foreign key to primary references?
Flashcards
What is a relation?
What is a relation?
Named, two-dimensional table of data with rows and columns.
What is a primary key?
What is a primary key?
A special field in a table that serves as a unique identifier. Guarantees all rows are unique.
What is a foreign key?
What is a foreign key?
An identifier that enables a dependent relation to refer to its parent relation.
What are domain constraints?
What are domain constraints?
Signup and view all the flashcards
What is entity integrity?
What is entity integrity?
Signup and view all the flashcards
Referential Integrity
Referential Integrity
Signup and view all the flashcards
What is Restrict (Delete Rules)?
What is Restrict (Delete Rules)?
Signup and view all the flashcards
What is Cascade (Delete Rules)?
What is Cascade (Delete Rules)?
Signup and view all the flashcards
What is Set-to-Null (Delete rules)?
What is Set-to-Null (Delete rules)?
Signup and view all the flashcards
What are simple attributes?
What are simple attributes?
Signup and view all the flashcards
What are composite attributes?
What are composite attributes?
Signup and view all the flashcards
What is a multi-valued attribute?
What is a multi-valued attribute?
Signup and view all the flashcards
What is a One-to-Many binary relationship?
What is a One-to-Many binary relationship?
Signup and view all the flashcards
What is a Many-to-Many binary relationship?
What is a Many-to-Many binary relationship?
Signup and view all the flashcards
What is a One-to-One binary relationship?
What is a One-to-One binary relationship?
Signup and view all the flashcards
Associative entity, Identifier Not Assigned
Associative entity, Identifier Not Assigned
Signup and view all the flashcards
Supertype/Subtype Relationships
Supertype/Subtype Relationships
Signup and view all the flashcards
What is Data Normalization?
What is Data Normalization?
Signup and view all the flashcards
What is Data Normalization?
What is Data Normalization?
Signup and view all the flashcards
What is Insertion Anomaly?
What is Insertion Anomaly?
Signup and view all the flashcards
What is Deletion Anomaly?
What is Deletion Anomaly?
Signup and view all the flashcards
What is Modification Anomaly?
What is Modification Anomaly?
Signup and view all the flashcards
General rule of thumb for table
General rule of thumb for table
Signup and view all the flashcards
What is Functional Dependency?
What is Functional Dependency?
Signup and view all the flashcards
What is Candidate Key?
What is Candidate Key?
Signup and view all the flashcards
What is First Normal Form?
What is First Normal Form?
Signup and view all the flashcards
What is Second Normal Form?
What is Second Normal Form?
Signup and view all the flashcards
What is Third Normal Form?
What is Third Normal Form?
Signup and view all the flashcards
Functional Dependencies
Functional Dependencies
Signup and view all the flashcards
Synonyms in merging
Synonyms in merging
Signup and view all the flashcards
Homonyms
Homonyms
Signup and view all the flashcards
Transitive Dependencies in merging
Transitive Dependencies in merging
Signup and view all the flashcards
Supertype/subtype relationships in merging
Supertype/subtype relationships in merging
Signup and view all the flashcards
Enterprise Keys
Enterprise Keys
Signup and view all the flashcards
Study Notes
- Tables consists of rows (records) and columns (attribute or field).
Components of the Relational Model
- Data structure includes tables, rows, and columns.
- Data manipulation can be performed with SQL operations for retrieving and modifying data.
- Data integrity has mechanisms for implementing business rules that maintain integrity of manipulated data.
Relation Requirements
- Relation is a named, two-dimensional table of data.
- It must have a unique name.
- Every attribute value must be atomic (not multivalued, not composite)
- Every row must be unique
- Attributes must have unique names
- The order of the columns and rows must be irrelevant.
- All relations are in first normal form.
Correspondence with E-R Model
- Relations or tables in the relational model correspond with entity types and many-to-many relationship types in the E-R Model
- Rows correspond with entity instances and many-to-many relationship instances
- Columns correspond with attributes
- The term "relation" in relational database is different from "relationship" in the E-R model.
Key Fields
- Keys are special fields that serve two purposes.
- Primary keys are unique identifiers of a relation, such as employee numbers or social security numbers.
- Foreign keys enable a dependent relation to refer to its parent relation.
- Keys can be simple or composite.
- Keys are used as indexes to speed up query responses.
Integrity Constraints
- Domain Constraints are allowable values for an attribute
- Entity Integrity means no primary key attribute may be null, and all primary key fields must have data.
- Action Assertions are business rules.
Referential Integrity
- Referential Integrity states any foreign key value MUST match a primary key value.
- For Delete Rules, there are three options:
- Restrict: Don't allow delete of parent side if related rows exist in dependent side
- Cascade: Automatically delete dependent side rows that correspond with the parent side row being deleted.
- Set-to-Null: Set the foreign key in the dependent side to null if deleting from the parent side, but this is not allowed for weak entities.
- Referential integrity constraints can be implemented using foreign keys referencing primary keys.
Mapping Regular Entities to Relations
- Simple E-R attributes map directly onto the relation
- Composite attributes utilize only their simple, component attributes.
- Multivalued attributes create a separate relation with a foreign key taken from the superior entity.
Mapping Weak Entities to Relations
- Weak entities become a separate relation with a foreign key from the superior entity.
- The primary key is composed of a partial identifier of weak entity and the primary key of identifying relation (strong entity).
Mapping Binary Relationships to Relations
- One-to-Many: The primary key on the one side becomes a foreign key on the many side
- Many-to-Many: Creates a new relation with the primary keys of the two entities as its primary key
- One-to-One: the primary key on the mandatory side becomes a foreign key on optional side.
Mapping Associative Entities to Relations
- If the identifier is not assigned, the default primary key for the association relation consists of the primary keys of the two entities.
- If the identifier is assigned it is natural and familiar to end-users, the default identifier may not be unique
Mapping Unary Relationships to Relations
- One-to-Many relationships have a recursive foreign key in the same relation.
- Many-to-Many relationships require two relations.
- one relation for the entity type
- one relation for an associative relation in which the primary key has two attributes taken from the primary key of the entity
Mapping Ternary Relationships
- One relation for each entity, and one for the associative entity.
- The associative entity has foreign keys to each entity in the relationship.
Mapping Supertype/Subtype Relationships
- One relation for supertype and for each subtype.
- Supertype attributes include identifier and subtype discriminator that go into the supertype relation.
- Subtype attributes go into each subtype, the primary key of supertype relation becomes the primary key of subtype relation
- 1:1 relationship established between supertype and each subtype, with supertype as primary table
Data Normalization
- Data Normalization is a tool to validate and improve a logical design to satisfy constraints and avoid unnecessary data duplication.
- It decomposes relations with anomalies to produce smaller, well-structured relations.
Well-Structured Relations
- These contain minimal data redundancy and allow users to insert, delete, and update rows without inconsistencies.
- Insertion Anomaly: Adding new rows forces the user to create duplicate data
- Deletion Anomaly: Deleting rows may cause a loss of data that would be needed for future rows
- Modification Anomaly: Changing data in a row forces changes to multiple rows because of duplication.
- A table should not pertain to more than one entity type.
Functional Dependencies and Keys
- Functional Dependency means the value of one attribute determines the value of another attribute
- Candidate Key is a unique identifier, and one of the candidate keys will become the primary key.
- Each non-key field is functionally dependent on every candidate key.
Normal Forms
- First Normal Form: No multivalued attributes, and every attribute value is atomic. All relations are in 1st Normal Form.
- Second Normal Form: Is 1NF with every non-key attribute fully functionally dependent on the entire primary key. Meaning every non-key attribute must be defined by the entire key, not just part of the key, also no partial functional dependencies.
- Third Normal Form: Is 2NF with no transitive dependencies.
- Generally, 3rd normal form is considered sufficient.
Merging Relations
- This combines entities from multiple ER models into common relations
- Watch out for the following issues:
- Synonyms-two or more attributes with different names, but same meaning
- Homonyms-attributes with the same name, but different meanings
- Transitive dependencies-even if relations are in 3NF prior to merging, they may not be after merging
- Supertype/subtype relationships-may be hidden prior to merging.
Enterprise Keys
- Primary keys are unique in the whole database, not just within a single relation.
- Corresponds with the concept of an object ID in object-oriented systems.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.