Ch 2: Intro to the Relational Model Flashcards
True or False:
No two tuples in a Relation
can have exactly the same values
for all attributes
True!
The values of a tuple(row) must be such that they can
uniquely identify the tuple.
Therefore, we can always distinguish between tuples.
How Seperate Tables
Can Be Related
Use Common Attribute Names:
Example:
The “Department” and “Teachers” table both have an attribute called “Dept_Name”
Can get a Department Name from the “Department” table,
then use it to find all “Teacher” tuples that have that Department
Relation Schema
- A Relation is similar to a variable
- A Relation Schema is more like a Type Definition
The Relation Schema consists of a list of attribute names and their corresponding domains.
Structure: Relation_Name( attribute, attribute, … )
example: department( dept_name, building, budget)
Relational Model:
Table Structure
- Each table is assigned a unique name
- Columns represent a certain Attribute and have header info
- Each Row is a set of related data,
- It is an n-tuple of values
- If an attribute is unknown, or doesn’t exist for a particular relation instance, the null value is used
Relational Model:
Types of Keys
- Super Key
- A set of one or more attibutes which allow a tuple in a relation to be uniquely identified.
- A good example would be (User_ID, Name)
- Candidate Key
- A Super Key that can’t be reduced further
- No proper subset is also a Super Key
- A Super Key that can’t be reduced further
- Primary Key
- A Candidate Key chosen by the database designer to identify tuples within a relation.
- Must be chosen with care
- Foreign Key
What is a
Data Model ?
A notation for describing data or information.
The description generally consists of 3 parts:
- Structure of the data
-
Operations on the data
- Queries
- Modifications
- Constraints on the data
What is a Key
for a relation ?
- The most fundamental kind of constraint
- A set of attributes forms a Key for a relation when:
- No two tuples in a relation instance may have the same values in all attributes of the key
- This makes it a unique identifier for each tuple
Argument for
Why the Relational Model
is preferred in DBMS
- DBs are large, so access efficiency and modification efficiency are very important.
- Ease of Use is also important
Both goals can be achieved with the Relational Model:
- Simple, limited approach to structuring data,
- yet reasonably versatile, so anything can be modeled
- Limited, yet useful collection of operations on data
Two most important
Data Models for
Database Systems
- Relational Model
- Tables or arrays
- Including Object-Relational extensions
- Semistructured Data Model
- trees or graphs
- Includes XML and related standards