Chapter 2 - The Relational Model Flashcards
What is an Entity?
Something of importance to the user that needs to be represented in a database. It can be represented by a single table.
What is a Relation?
A two-dimensional table consisting of rows and columns
What are the Characteristics of a Relation? (1-4)
- Rows contain data about an entity
- Columns contain data about attributes of the entity
- Cells of the table hold a single value
- All entries in a column are of the same kind
What are the Characteristics of a Relation? (5-8)
- Each column has a unique name
- The order of the columns is unimportant
- The order of the rows is unimportant
- No two rows may hold identical sets of data values
What are some examples of Poorly-Formed Relations?
Multiple entries per cell
The order of the rows affects the table
Different kinds of column entries
Variable-length column values
How do we Notate Relation Structures?
Relation names are in ALL CAPS (and always singular; if two words, separate by an underscore)
A column name is with the first letter capitalized (if two words, run together LikeThis)
The primary key is underlined
All the attributes of a table are listed in parentheses
Foreign keys are in italics
What is a database schema?
A database schema is the design on which a database and its associated applications are built.
What are the Synonyms for Tables, Rows, and Columns?
Tables = Files = Relations
Rows = Records = Tuples
Columns = Fields = Attributes
What is a Key?
One or more columns of a relation that is used to identify a row. A key can be unique (primary) or nonunique (foreign)
What are Composite and Candidate Keys?
A composite key contains two or more attributes.
A candidate key uniquely identifies each row in a relation.
What is a Primary Key (PK)?
A candidate key that is chosen as the key that the DBMS will use to uniquely identify each row in a relation. The PK will be underlined.
What is a Surrogate Key?
A column with a unique, DBMS-assigned identifier that has been added to a table to be the primary key.
Example, with an address it takes street, city, zip, etc. to identify a unique row. A surrogate key might add in a PropertyID to function as a unique identifier in a single row.
What is a Foreign Key?
A primary key of another table that has been placed in the current table to represent a relationship between the tables.
What is the Referential Integrity Constraint with Foreign Keys?
A referential integrity constraint states that every value of a foreign key must match a value of an existing primary key.
What is a Null Value? What are some Issues with having Null Values?
A null value is a missing value in a cell in a relation.
The problem with null values is that it is ambiguous. Is it that no value is appropriate? Or is the value known, but not entered? Or is the value unknown, and therefore not entered?