Lecture 3: Relational Databases Flashcards
What is a relational DB
- Popular database type
- Each relation is a table. Relational databases are organized as tables
- Tables: Rows, Columns
- Poweful tool for storing and accessing data
- Simple data representation
- Ease to customise
- Using SQL
- Implemented in most popular DBMS
What do the columns contain?
Fields / attributes (field names)
What do the rows contain?
Records / tuples
What is an attribute domain?
Data type = allowed value, bijv. ’integer’, ‘string’, ‘real number’
Can tuples be identical?
No
Which two concepts exist on the model level of a DB?
Schema vs. instance
Explain schema
meta-data = column head for the data, i.e. how data has to be structured at the logic level.
Specifies name of table, attributes and the attribute domains.
Rarely changes (high costs to update!)
Explain instance
Tuple, content of the data
Changes regularly and easy, but conforms to schema
Define keys
A set of one or more attributes (columns) in the
table that have certain properties
More formally = Set or combination of attributes in table that have certain properties.
Define compound key
Key that includes two or more attributes (and can be used to look up tuples)
Define superkey
“Unique key.” Any set of attributes of columns which help to identify rows in a table uniquely. No two tuples have the same values. Can uniquely identify a specific tuple in a table (for example in enrollment database the SID and CID)
Define cadidate key
Minimum super key
Define primary key
Used to uniquely identify or find the records in a table. A table can have only one primary key.
– Every tuple in a relational database has its own
primary key
- Primary key cannot be null!
Define secondary key
Key used to lookup tuple, but may not guarantee uniqueness
Define foreign key
Key in another table. Used to locate records in another table.
Key is used a as constraint rather that to find a tuple