1/88
New content after midterm exam, final exam will contain both midterm and final exam content.
A relational model represents data as a ___
collection of relations
What is an informal way to communicate the fact that relational models represent data in relations?
Each relation resembles a table of values

What does a table of values contain?
Rows, table names, and column names

What is a tuple?
A set of elements which can be the same as a row

What do table and column names do?
Help interpret the meaning of the values in each row

What is a domain?
A set of atomic values
Each value in the domain is indivisible
What does it mean to specify a domain?
To provide logical definitions for the domain names, which will imply what data falls within them.
USA_phone_numbers
Names
What does it look like for a data type to be specified for each domain?
Give an example for the domain type: 'USA_phone_numbers’
A data type can be declared as a character string, in which each letter represents a digit.
(ddd) ddd-dddd
What is a relation schema? How is it denoted?
Used to describe a relation
Denoted by R(A1 , A2 , A3 … An)
What is the attribute Ai?
The name of a role played by some domain D in a relation schema R
D is called the domain of Ai and is denoted by dom(Ai)
What is the degree of a relation?
The number of attributes n of its relation schema
What is a relation state?
An instance of relation r of the relation schema R(A1 , A2 , A3 … An), also denoted by r(R), is a set of n-tuples r = {t1 ,t2 ,…, tn)
What is a primary key?
An attribute in a relational schema that is a key attribute
Their values uniquely identify tuples in the relation
Key attributes become _____ which can be come ____ or _____
Key attribute become candidate keys which can become primary keys or unique keys.
What is the main physical characteristic of a primary key?
Attributes of that form are underlined
When a relation has more than one candidate key, the choice of one becoming a primary key is ____
Arbitrary
It is usually better to choose a primary key with ___ or ___
A single attribute or a small number of attributes
What does the entity integrity constraint state?
No primary key value can be NULL
A tuple that refers to another relation must ___
refer to an existing tuple in that relation
How do we enforce referential integrity constraints?
We use foreign keys
What is a foreign key?
A column, or group of columns, in a table whose values refer to a key in another table. It links the tables and enforces referential integrity

What are the main rules that a foreign key must follow?
The foreign-key columns must match the referenced key’s columns.
Each foreign-key value must either match a key value in the other table or, if allowed, be empty (NULL).

How many referential integrity rules are shown here?
8
What is the main goal of ER-to-Relational mapping
Preserve all information by including all attributes
Maintain the constraints to the extent possible
Minimize NULL values
What is the steps in creating an ER-to-Relational Schema?
Map regular entity types
Map the weak entity types
Map binary 1:1 relation types
Map binary 1:N relation types
Map binary N:M relation types
What do you need to consider when mapping regular entity types?
Composite attributes are split into multiple simple attributes
What do you need to consider when mapping weak entity types?
The PK of the relation is the combination of the PK(s) of the owner(s) and the partial key of the weak entity type W
What do you need to consider when mapping binary 1:1 entity types?
There are three possible approaches
Foreign key approach
Merged relation approach
Cross -reference / relationship relation approach
What is the Foreign Key approach for mapping Binary 1:1 relationship types?
Choose one of the relationships and include as an FK in S and PK of T
What is the merged relation approach for mapping Binary 1:1 relationship types?
Merge the two entity types and the relationship into a single relation
Only appropriate when both participations are total
What do you need to consider when mapping binary 1:N entity types?
identify the relation S that represents the participating entity type at the N-side of the relationship type.
What do you need to consider when mapping binary N:M entity types?
Create a new relation D to represent R
A relationship relation
Include as FK attribute in S the PKs of the relations that represent the entity types
Their combination will form the PK of S
Include any simple attributes too
What do you need to consider when mapping multi-valued attributes?
Create a new relation that will include an attribute corresponding to A, and the PK of the relation that represents the entity type or relationship type that has A as a multivalued attribute.
What do you need to consider when mapping N-ary relationship types?
Include as FK attributes in S the PKs of the relations that represent the participating entity types.
What is a relational database design? What are its main goals
The grouping of attributes to form good relational schemas
Minimize redundancy, information preservation
Why is it important to have a relational database design alongside a E-R or EE-R conceptual model?
You are analyzing why one grouping of attributes is better than the other
What are the two levels of “goodness” in relational schemas
Logical
Implementation
What is the logical level of a relational schema?
Shows how users interpret the relation schema and the meaning of their attributes
What is the implementation (physical) level of a relational schema? By what means is it created?
Shows how tuples in a base relation are stored and updated. Most likely created through a Data Definition Language.
What is a base relation? And how is the information in one stored.
A relation declared through the CREATE TABLE statement. Stored in tables in a DBMS platform.
The implementation level of relation schemas only apply to ________
Base relations
What are the informal guidelines of good relational design?
Remember (SSRN)
The semantics of the attributes are clear (Semantics)
Not allowing spurious (false) tuples (Spurious Tuples)
Reducing redundant information (Redundancy)
Reducing NULL values (NULL)
What are the formal concepts for functional dependencies?
First Normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Boyce-Codd Normal Form (BCNF)
What is informal guideline 1 (Semantics) for functional dependencies?
Each row should describe one thing (one person, one order, or one relationship between two things)
Design a schema that can be designed easily. Relation-by-Relation
If one table needs to refer to something described in another table, use a foreign key.
What conceptual competent should only refer to other entities as stated in guideline 1?
Foreign Keys
What are the negative effects of storing redundant information?
Wastes storage
Causes problems with update anomalies
Insertion, Deletion, and Modification operations
What is informal guideline 2 (anomalies) for functional dependencies?
Design a schema that does not suffer from insertion, deletion, or modification anomalies.
Describe an insertion anomaly, using example of EMP_PROJ
Cannot insert a project unless an employee is assigned to it
Cannot insert an employee unless they are assigned to a project
Describe an deletion anomaly, using example of EMP_PROJ
When a project is deleted, it will delete all employees that work on that project
Describe an modification anomaly, using example of EMP_PROJ
If we change the value for the manager of a department, then we will need to update all the corresponding values
What are the main reasons why NULL values might show up on a relational schema?
Attribute not applicable or invalid
Attribute value unknown
Value known to exist, but unavailable
What is informal guideline 3 (NULL) for functional dependencies?
Relations should be designed such that their tuples will have as few NULL values as possible.
Attributes that frequently have NULL values could be placed in different relations.
What is informal guideline 4 (spurious) for functional dependencies?
Have the appropreate primary and foreign key associated with each relation
Avoid relations that have the same attributes and are not foreign or primary keys
What could bad relations end up becoming in a DBMS platform?
Erroneous results for certain JOIN operations
What property is used to maintain results in a DMBS platform
The Lossless property - used to guarantee meaningful results.
What is a natural JOIN?
Combining two tables by matching rows that have equal values in every column name they share.
What is a functional dependency (FD)?
A constraint between two sets of attributes (in a relation state R) from the database on the possible tuples that can form from a relation state of R.
What does it mean for X to be functionally dependent on Y?
The values on the X component of the tuple are uniquely determine the values of the Y component.
What is the main use of an FD and how are they derived?
They come from real-world constraints on the attributes for the purposes of describing a relation schema and specifying which constraints hold at all times.
What is the most important concept in relational schema design theory?
Functional Dependency (FD)
What is a spurious tuple?
An extra row produced when you join tables that were split from a larger table.
It looks like valid data, but it asserts a relationship that wasn’t in the original data.
What is a single universal schema?
This terminology is used to describe an entire database as one relation (table) with all its attributes.
What is a candidate key?
The minimal set of attributes that uniquely identifies each row (column) in a relation (table).
What do we need to know in order to accurately determine which FDs will hold
We need to know the meaning of and the relationships among the attributes
What are legal relation states?
Relational extensions that satisfy the FD constraints
By what condition do you know that X functionally determines Y?
If whenever two rows in R have the same values for X, they also have the same values for Y
What is normalization?
The process of decomposing bad relations by breaking up their attributes into smaller relations
What does normalization do for a relation schema?
Takes a schema through a series of tests that certify if it satisfies a certain normal form.
What are all normal forms based from?
An analytical tool - the Functional Dependencies among the attributes of a relation.
What is the purpose of normalization?
Minimize redundancy
Minimize insertion, addition, and modification anomalies
What is the definition of a normal form?
The highest form condition that it meets, and shows the degree to which it had been normalized.
Do normal forms guarantee good DB design?
No they do not
What are the two decomposition properties that relational schemas must posess?
Dependency preservation and Lossless properties
Describe the nonadditive (lossless) JOIN property?
Ensures that spurious tuples do not occur with respect to relational schema after decomposition.
VERY CRITICAL
What is the dependency preservation property?
Ensures that each FD is represented in some individual relation after decomposition
Not as necessary, but important if it still occurs
Is it necessary to design to the highest normal form possible?
No it is not, 3rd Normal Form is the most common in relational schema design.
What is a superkey?
One or more attributes that together uniquely identify each row in a table.
Every relation has at least one _____
Superkey
What is an issue that can come up with Superkeys?
A superkey could include columns it doesn’t need. Even if you remove one of those columns, the remaining columns still uniquely identify every row.
What is the difference between a key and a superkey?
A key is a superkey with no extra attributes. If you remove any attribute from it, it can no longer uniquely identify every row.
Has to be minimal
What does it mean for a key (K) to be time-invariant?
The properties do not change overtime
If a relation has more than one key, it is called a ___
candidate key
What is the process of assigning a primary key from a candidate key?
It is an arbitrary process in which one key is titled a primary key and the other is a secondary key
What is a prime attribute?
A member of a candidate key
What does 1NF disallow?
Relations within relations or relations as attribute values within tuples (NON ATOMIC)
Composite attributes
Multivalued attributes
Nested relations
What does 2NF disallow?
This form disallows partial functional dependency within the relation. in which nonprime attributes are partially dependent on a composite primary key.
If a primary key contains a single attribute, does the 2NF test need to be executed?
No, because every attribute is already fully functionally dependent on the primary key
What does 3NF disallow?
This form disallows transitive dependency. Where one attribute determines a second attribute through a third attribute.
In X - Y and Y - Z, with X as the primary key, we consider this a problem only if Y _____
Not a primary key