The Relational Model
Database = set of named relations (tables)
each relation has a set of named attributes (columns)
Each tuple (row) has a value for each attribute
each attribute has a type (domain)
Schema – structural description of relations in database
Instance – actual contents at given point in time
Null – special value for “unknown” or “undefined”
Key – attribute whose value is unique in each tuple or set of attributes whose combined values are unique
Example.
Creating relations (tables) in SQL
Create Table Student(ID, name, GPA, photo)
Create Table College
(name string, state char(2), enrollment integer)
Slides from Course : Relational Databases: The Relational Model
Querying Relational Databases
- Design, create using a DDL (Data Definition Language)
- Bulk Load Initial Data
- Repeat: execute queries and modifications
Query Language / DML (Data Manipulation Language)
Compositionality – the ability to run a query over the results of a past query.
Query Languages
- Relational Algebra (formal)
- SQL – actual/implemented