本文共 3379 字,大约阅读时间需要 11 分钟。
oracle中dbms
Relational calculus uses variable, the formula for state and it has the same expressive power. There is two type of Relational calculus:
关系演算使用变量,状态公式,并且具有相同的表达能力 。 关系演算有两种类型:
Tuple relational calculus
元组关系演算
Domain relational calculus
领域关系演算
It is also known as predicate calculus. Tuple (t) variable range for all tuple of relation or table (R).
它也称为谓词演算。 关系或表(R)的所有元组的元组(t)可变范围。
t.A --> Column ‘A’ of tuple ‘t’
tA->元组't'的列'A'
Basic form: { T | P ( T ) } where, T is variable and P(T) is formula to fetch true tuple.
基本形式:{T | P(T)} ,其中T是变量,而P(T)是提取真实元组的公式。
Like: { t.A1, t.A2 … t.Ai | θ }
像:{t.A1,t.A2…t.Ai | θ}
where, t.A1, t.A2 ... t.Ai is predicate calculus expression and θ is condition.
其中, t.A1,t.A2 ... t.Ai是谓词演算表达式,θ是条件。
Let, we have a table name Student [ R.No, Name, D.No, Gender ]
让我们有一个表名Student [R.No,Name,D.No,Gender]
Example: - Find R.No and Name of all student in D.No is 2.
示例:-查找R.No,D.No中所有学生的姓名为2。
{ t.R.No, t.Name | t ϵ Student (Student(t)) ^ t.D.N0 = 2 }
{tRNo,t.Name | t ϵ学生(学生(t))^ tDN0 = 2}
Relational calculus uses variables, constant, comparison operators ( ==, >, =, <=, != ), logical operators (˅ , ˄) and quantifiers ( Ǝ, ᵿ ).
关系演算使用变量,常量,比较运算符(==,>,=,<=,!=),逻辑运算符(˅,˄)和量词(Ǝ,ᵿ)。
Quantifier:
量词:
Condition is expressed by use quantifier with a tuple variable. Two type of quantifiers is there Ǝ (there exists), ᵿ (for all) .
条件是通过使用带元组变量的量词来表示的。 (存在)有两种类型的量词,(全部)。
Like: -
喜欢: -
Ǝt (variable) -> R(θ(t)) (relation and condition)
Ǝt(变量)-> R(θ(t))(关系和条件)
ᵿt (variable) -> R(θ(t)) (relation and condition)
ᵿt(变量)-> R(θ(t))(关系和条件)
there exists a tuple in ‘t’ (set of tuple) in relation ‘R’ such that ‘θ’ predicate condition is true.
关系“ R”中的“ t”(元组集合)中存在一个元组,使得“θ”谓词条件为真。
Θ(t) is true for all tuple in ‘t’ in relation ‘R’.
对于关系“ R”中“ t”中的所有元组,Θ(t)是正确的。
Variable uses: Free tuple (no quantifier use), use quantifier in bound expression.
变量使用:自由元组(不使用量词),在绑定表达式中使用量词。
Example: List all the employee name who have no manager.
示例:列出所有没有经理的员工姓名。
{ t.name | t ϵ emp ( Ǝ emp) ˄ manager = ‘NULL’ }
{t.name | t ϵ emp(Ǝemp)˄管理器='NULL'}
Domain (d (attribute)) variable range for all domain (columns) of relation or table (R). It is similar work on all the domains (columns) as tuple relational calculus work for all row.
关系或表(R)的所有域(列)的域(d(属性))变量范围。 它在所有域(列)上都是类似的工作,就像元组关系演算在所有行上一样。
Basic form: { D | P ( D ) } where, D is variable and P(D) is formula to fetch true domain.
基本形式:{D | P(D)} ,其中D是变量,P(D)是获取真实域的公式。
Like: { d.A1, d.A2 … d.Ai | θ }
像:{d.A1,d.A2…d.Ai | θ}
where, d.A1, d.A2 ... d.Ai is domain calculus expression and θ is condition.
其中, d.A1,d.A2 ... d.Ai是域演算表达式,θ是条件。
Let, we have a table name Student [ R.No, Name, D.No, gender ]
让我们有一个表名Student [R.No,Name,D.No,female]
Example: - Find R.No and Name of all student in D.No is 2.
示例:-查找R.No,D.No中所有学生的姓名为2。
{ d.R.No, d.Name, d.D.No, d.gender | d ϵ Student (Student(d)) ^ d.D.N0 = 2 }
{dRNo,d.Name,dDNo,d.gender | d ϵ学生(学生(d))^ dDN0 = 2}
Conclusion
结论
In this article, we have learned about what is relation calculus and its different types with example? I hope you all clear the concept. Stay tuned for the next article, we will discuss more it in the upcoming articles. Have a nice day! Happy Learning!
在本文中,我们通过示例了解了什么是关系演算及其不同类型? 希望大家都明白这个概念。 请继续关注下一篇文章,我们将在以后的文章中讨论更多内容。 祝你今天愉快! 学习愉快!
翻译自:
oracle中dbms
转载地址:http://ubvzd.baihongyu.com/