Lecture 1 - Relational Model Flashcards
Any entity and any relationship are modelled as a …
relation, which maps to a 2D table.
What does a 2d table in a relational model have and what do these represent?
- an ordered set of attributes (columns)
- a set of tuples representing instances (rows)
- a specific unique attribute that identifies a tuple in a relation (could be sequential or logical)
What is a query?
attributes of interest to be retrieved and constrained attributes to filter out irrelevant or unncessary tuples in the context
Bank account context example of a select all query with active accounts that have over 500 pounds?
SELECT name FROM BankAccount
WHERE balance > 500 AND status = ‘active’
Formally how is a relation represented?
Rname (attr1 , attr2 , …. , attrn) with each attribute being within a specific domain e.g. int or text
What is a schema?
A relation schema can be thought of as the basic information describing a table or relation.
What is a relation?
The conceptual model for storing contextual data
What is a tuple?
ordered set of values corresponding to attributes of the relation and satisfying the domain constraints
Relation vs schema
Relation is the model for an entity and its relationships, it is conceptual. A schema is how the relation will be placed in a table (i.e. table design )
What is an instance?
A set of tuples -> populated table / rows in the table
What is NULL?
represents an unknown, or inapplicable, or uncertain, or missing value
-> the meaning behind NULL for a certain attribute comes with context
Relational Database Schema
set of relations (design of the tables for the whole database (how should each relation be implemented))