The Relational Model Pratt & Adamski, Chapter 2
Relational Algebra zProject zSelect zJoin z Union z Intersect z Subtract z Product z Division
Relational Database zBased in formal set theory zMost common data structure zProvable design principles
Relational Definition zRelations zAttributes zRelationships zOperations
Relation Attributes Occurrences or Tuples
Relation Requirements zAttributes are single valued, and all entries have the same data type zEach attribute has a distinct name zAll values in a column are values of the same attribute zThe order of columns is irrelevant zEach row is distinct zThe order of rows is irrelevant
Premiere Products Example
Row Operations: Select, Project, Join zSELECT returns desired rows zPROJECT returns desired columns zJOIN creates one table from two by matching specified column values in the two tables
Set Operations: Union, Intersection, Difference Returns the union, intersection, or difference of rows in two tables Note: both tables must be “union compatible.” They must have the same number of columns and the corresponding columns must have the same data types.
Table Operations: Product, Division zPRODUCT (Cartesian product) produces a table with the columns of both tables and rows consisting of all combinations of rows from the two tables. If table A has m rows and table B has n rows, the product will have m*n rows. zDIVISION (A divided by B where the columns in B are also in A) produces a table consisting of columns in A that are not in B and match all the rows in B.