Quiz 1 Flashcards
Relational Model
Collection of Tables to represent both data and relationships
Tables
Have unique names and fixed set of columns.
AKA “Relations:
Relation
In math terminology, it is a set of tuples
Tuple
In laymens terms it is referred to as a row but can also be described as a sequence (or list) of values.
Attribute
Column
Domain of the attribute
Set of allowed values for an attribute
Atomicity
indivisible
phone numbers and addresses are not atomic
Null value
A special value that is unknown or does not exist.
e.g. in the instructor table, someone might not have a phone number and therefore that field will be left as null for that person.
They can cause difficulties when we access or update databases so we try to eliminate them as much as possible
Relation Schema
A list of attributes and their corresponding domains.
e.g.
Instructor ( ID, name, dept_name, salary)
Department (dept_name, building, budget)
Relation instances
Current values of a relation
Does order of tuples matter?
No
Should two tuples have the same value for all attributes?
No
SuperKey
A set of one or more attributes that uniquely identify a tuple
e.g. ID or Name but ID is better because someone can have the same name
If K is a SuperKey then:
Any superset of K is also a superKey. So if ID is a superkey then any combination of ID and name is also a superkey.
Candidate Key
Special kind of superkey (minimal superkey). Any proper subset of candidate key can’t be a superkey.
e.g. ID and name are possible candidate keys because all other subsets of that key is not a superkey, which in this case is just zero.
Primary Key
A candidate key
Chosen by DB designer
its attributes values are never, or very rarely changed.
e.g. SSN
and ID or unique identitifier might not be good when say two enterprisees merge and then id values may overlap but in our instructor table/relation that is the best we got…
Primary Key Relation Schema
department(dept_name, buildings, budget)
Primary key underlined and before all other attributes