Relational data model
The Relational Data Model uses the mathematical concept of a relation as the formalism for describing and representing data. The relations are represented as a table of values and have sets of rows, which represent certain facts about an entity or a relation in the real world. Each column has a header that represents the significance of the elements in that column.
Relational schemas are formally described as a k-ary relation schema R(A1, A2, , AK), which is a set A1, A2, , Ak of k attributes.
Example:
COURSE(course-no, course-name, term, instructor, room, time)
CITY-INFO(name, state, population)
Thus, a k-ary relation schema is a blueprint, a template for some k-ary relation.
A relational database schema is a set of relation schemas Ri (A1, A2, , Aki ), for 1 ≤ i ≤ m.
Example:
UNIVERSITY relational database schema :
STUDENT(student-id, student-name, major, status)
FACULTY(faculty-id, faculty-name, dpt, title, salary)
COURSE(course-no, course-name, term, instructor)
ENROLLS(student-id, course-no, term)
There can be certain constraints in the relational schema, and they can be:
- Key constraints - eg. one key can be a primary key, a candidate key, or a superkey
- Entity integrity constraints - eg. the primary key cannot have null values
- Referential constraints - eg. the outer key is a key that connects two entities, so they can be joined by that key
