Relational Model
Database based on relational model is relational database. SQL is made in relational model.
The basic component of relational model is ‘relation’. Relation in relational model means a table, not a relationship between tables.
In relation, there are attributes, which are columns of SQL. There are also tuples, which are rows of SQL.
Relational Algebra
Relational algebra is a theory that operations of relations correspond to the operations of sets.
Let’s compare several relational operations and SQL.
| Relational Operation | SQL | Meaning |
|---|---|---|
| Union | UNION |
Addition of relations |
| Difference | EXCEPT |
Subtraction of relations |
| Intersection | INTERSECT |
Common part of relations |
| Cartesian product | CROSS JOIN |
Cartesian product of relations |
| Selection | WHERE |
Extraction of tuples |
| Projection | SELECT |
Extraction of attributes |
| Join | INNER JOIN |
Extraction of desired tuples in the result of Cartesian product |
All images, except those with separate source indications, are excerpted from lecture materials.
댓글남기기