110 likes | 290 Views
The Relational Model. Pratt & Adamski, Chapter 2. Project Select Join. Union Intersect Subtract Product Division. Relational Algebra. Relational Database. Based in formal set theory Most common data structure Provable design principles. Relational Definition. Relations Attributes
E N D
The Relational Model Pratt & Adamski, Chapter 2
Project Select Join Union Intersect Subtract Product Division Relational Algebra
Relational Database • Based in formal set theory • Most common data structure • Provable design principles
Relational Definition • Relations • Attributes • Relationships • Operations
Relation Attributes Occurrences or Tuples
Relation Requirements • Attributes are single valued, and all entries have the same data type • Each attribute has a distinct name • All values in a column are values of the same attribute • The order of columns is irrelevant • Each row is distinct • The order of rows is irrelevant
Row Operations:Select, Project, Join • SELECT returns desired rows • PROJECT returns desired columns • JOIN 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 • PRODUCT (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. • DIVISION (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.