Relational DBMS Flashcards
How are data stored in a relational database?
In predefined tables that have attributes and relations
What are tables also called?
Entities and relations
What does the tables look like?
The tables are made up of columns and rows.
What can we say about a row in a DB?
It is a tuple of data.
There are no duplicate rows.
Their order is irrelevant.
What can we say about a column in a table in a relational database?
It contains a value for an attribute
How can we uniquely define the rows
With Id’s: primary and composite keys
What is a primary key
It is an attribute that uniquely identifies a tuple (row)
What is a composite key?
It is a primary key that consist of two attributes.
What is the Entity integrity rule?
The primary key or the attributes making up the composite key should not be null!
What is a candidate / alternate key
attributes that also can uniquely identify a row in a table - are referred to as candidate keys or alternate keys
What is a foreign key?
it is an attribute that refers to a parent table. They are required to match the primary key of the parent table
What is referential integrity constraints?
It is constraints that are in place to achieve referential integrity
What is an example of referential integrity constraints?
For example that a primary key or a foreign key can’t be null.
Or if a key refers to a record, that record cannot be deleted.
What is cascade?
It is something you put on a foreign key to decide what happens on events like: update, delete
What cascade options are there?
NO ACTION
SET NULL
SET DEFAULT
CASCADE: On update, on delete