Week 4 Flashcards
What is a Relation?
A 2-dimensional table that has speicific characteristics
What is a Tuple in a Relation table?
Simply the horizontal row which contains all data for a single entity
What is the Candidate key in terms of Relations?
The minimal set of attributes whose values uniquely identify each tuple
What is the Foreign Key in terms of Relations?
An attribute, or set of attributes, withinb one relation that matches the primary key of another relation
What are properties of Relations?
A relation has a name that is distinct from all other relation names in the database
Each cell of the relation contains exactly one atomic (single) value
Each attribute has a distinct name
The values of an attribute are all from the same domain
Each tuple is distinct - there are no duplicate tuples
The order of attributes has no significance
The order of tuples has no significance
What is a Relation Schema?
A named relation defined by the relation name (table name) and attributes
R(A1,A2,A3…An)
What is a Relation Instance/state?
A set of tuples from a relation schema
r(R)
What are Integrity Constraints?
Restrictions placed on the values of attributes
What are the 3 types of Integrity Constraints?
Entity Integrity
Referential Integrity
Domain Constraint
What is Entity Integrity?
Uniqueness - No 2 tuples can have identical values for candidate keys
Not-Null- No attribute of a candidate key can be NULL
* Null - A value of an attribute is currently unknown or not applicable for this tuple
What is Referential Integrity?
If a foreign key exists in a relation:
- Either the foreign key value matches a primary key value in its home relation
- Or the foreign key value is NULL
What is a Domain Constraint?
Domain: the set of allowable values for one or more attributes
Domain Constraint simply puts constraints on what attributes can be eg. integer from 1-999
if invalid attribute is entered, then an error is given
eg. If the attribute Age is specified to be in the range 16-30, any number outside would give an error
eg. If the attribute Name is to hold a set of characters, then any multiplication or division operations on the attribute values are illegal
What is a View?
A subset of base relation(s)
What is a Base Relation?
A named relation corresponding to an entity in the conceptual schema, whose tuples are physically stored in the database
What are the Features of Views?
Virtual/Derived Relation - It does not necesasarily exist in the database, but can be produced upon request
Dynamic - The changes made to the base relation that affect the view are immediately reflected in the view
Generated by applying appropriate relational operations (eg. σ, π, x, ⋈ ,..)