Week 3 Flashcards
How is data represented in a relational data model
A collection of tables / a collection of relations
tables are called relations
What data is stored in rows
entities and relationships
What is in the column header
Attributes / attribute name
A row is also known as a …
tuple
A row contains an instance of what ever the relation name is . eg for a STUDENT (relation name) each row represents a specific student instance
bkjbjk
what does a key do in relational data model
Uniquley identifies a specific row ( and hence a specific instance as row = specific instance)
what is a domain
set of atomic (non -divisible) values allowed for an attribute
specifies the data type allowed for an attribute
what are surrogate / artificial keys
a unique identifier assigned to each record in a table,
eg I can increment studentID from by 1 each time to identify a student uniquely and that is a surrogate key
state
The content / data in the table at a particlular time
subset of the cartesian product of values in domain
tuples (rows) in a relational data model are…
unordered
For ease in the course , we will assume attributes are ordered as well
what does t[Ai]
for an arbituary tuple (row) t , the attribute denoted by the value of i
eg t[A2] the second attribute at the required tuple
What are the 3 main types of constraints in the relational data model
.Key constraints
.Entity integrity constraints
.Referential integrity constraints
implicit constraint is the domain constraint:
values in an attribute must be from the domain of that attribute
superkey info
a superkey is a set of one or more attributes (columns) that, taken together, can uniquely identify a tuple (row) in a table.
A key, on the other hand, is a minimal superkey, meaning it is a superkey with the fewest possible attributes. If removing any attribute from a key would cause it to lose its uniqueness, then that key is considered minimal.
Why is {serial no , Make} a superkey for a car
. At least one of the attributes can uniquely identify a car instance (tuple) [ serial no uniquely identifies}
However if you remove the make attribute it is still a superkey - Not minimal superkey - Therefore not a key
foreign key
. A foreign key is an attribute (or a set of attributes) in one relation (table) that establishes a link or reference to the primary key in another relation.
eg serial number ( primary key) for a CAR relation may link to a DRIVER relation
general rule of thumb - use the smallest sized key for primary key