1 / 49
文档名称:

Database Systems, Relational Algebra & Calculus (2000).pdf

格式:pdf   页数:49
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

Database Systems, Relational Algebra & Calculus (2000).pdf

上传人:bolee65 2014/4/14 文件大小:0 KB

下载得到文件列表

Database Systems, Relational Algebra & Calculus (2000).pdf

文档介绍

文档介绍:'DWDEDVH6\VWHPV $W]HQL&HUL3DUDERVFKL7RUORQH
&KDSWHU5HODWLRQDODOJHEUDDQGFDOFXOXV
Chapter 3
Relational algebra
and calculus
0F*UDZ+LOODQG$W]HQL&HUL3DUDERVFKL7RUORQH
1
'DWDEDVH6\VWHPV $W]HQL&HUL3DUDERVFKL7RUORQH
&KDSWHU5HODWLRQDODOJHEUDDQGFDOFXOXV
4XHU\ODQJXDJHVIRUUHODWLRQDOGDWDEDVHV
• Operations on databases:
– queries: "read" data from the database
– updates: change the content of the database
• Both can be modeled as functions from databases to databases
• Foundations can be studied with reference to query languages:
– relational algebra, a "procedural" language
– relational calculus, a "declarative" language
–(briefly) Datalog, a more powerful language
• Then, we will study SQL, a practical language (with declarative
and procedural features) for queries and updates
0F*UDZ+LOODQG$W]HQL&HUL3DUDERVFKL7RUORQH
2
'DWDEDVH6\VWHPV $W]HQL&HUL3DUDERVFKL7RUORQH
&KDSWHU5HODWLRQDODOJHEUDDQGFDOFXOXV
5HODWLRQDODOJHEUD
• A collection of operators that
– are defined on relations
– produce relations as results
and therefore can bined to plex expressions
• Operators
– union, intersection, difference
– renaming
– selection
– projection
– join (natural join, cartesian product, theta join)
0F*UDZ+LOODQG$W]HQL&HUL3DUDERVFKL7RUORQH
3
'DWDEDVH6\VWHPV $W]HQL&HUL3DUDERVFKL7RUORQH
&KDSWHU5HODWLRQDODOJHEUDDQGFDOFXOXV
8QLRQLQWHUVHFWLRQGLIIHUHQFH
• Relations are sets, so we can apply set operators
• However, we want the results to be relations (that is,
homogeneous sets of tuples)
• Therefore:
– it is meaningful to apply union, intersection, difference only
to pairs of relations defined over the same attributes
0F*UDZ+LOODQG$W]HQL&HUL3DUDERVFKL7RUORQH
4
'DWDEDVH6\VWHPV $W]HQL&HUL3DUDERVFKL7RUORQH
&KDSWHU5HODWLRQDODOJHEUDDQGFDOFXOXV
8QLRQ
Graduates
Number