Module 3 Flashcards
What is a relational database?
A database organized as a set of relations (tables).
What is a relation?
A two-dimensional table with rows (tuples) and columns (attributes).
What is a tuple in a relation?
A row in a table representing a single record.
What is an attribute in a relation?
A column in a table representing a specific property of entities.
What is a relation schema?
The structure of a relation, including its name and attributes.
What is a relation instance?
A specific set of tuples in a relation at a given time.
What is a database schema?
The collection of all relation schemas in a database.
What is a database instance?
The actual data stored in the database at a specific time.
What is a primary key?
A unique identifier for each tuple in a relation.
What is a candidate key?
A minimal superkey that can uniquely identify tuples.
What is a superkey?
A set of attributes that uniquely identifies a tuple, but may not be minimal.
What is a foreign key?
An attribute in one relation that references a primary key in another relation.
What is SQL?
A structured query language used to interact with relational databases.
Why is SQL important in relational databases?
It provides a high-level way to retrieve, insert, update, and delete data.
How do we convert an entity set to a relation?
Create a table with the same attributes as the entity set.
How do we convert a many-to-many relationship into relations?
Create a separate relation that includes foreign keys from both entity sets.
How do we convert a one-to-many relationship into relations?
Include the primary key of the ‘one’ entity as a foreign key in the ‘many’ entity.
How do we store a relationship set in a relational database?
Create a new table containing the primary keys of all participating entities.
What is the primary key of a relationship table?
The combination of primary keys of all participating entities.
How do we handle attributes on relationships?
Include them as additional columns in the relationship table.
How does the multiplicity of a relationship affect its primary key?
In a many-to-many relationship, the primary key includes both entity keys.
What is the primary key for a one-to-one relationship?
Either entity’s primary key can be used as the relationship’s primary key.
What is a weak entity set, and how is it stored in a relation?
A weak entity set has no primary key and relies on a strong entity’s key plus a discriminator.
What are the three approaches to converting ISA hierarchies to relations?
1) Separate tables, 2) Single table with NULLs, 3) Object-oriented method.