数据库中元组关系演算_元组关系演算| 数据库管理系统

元组关系演算是非过程性、声明性查询语言,用户通过描述查询来表达需求,而非提供执行步骤。它涉及在关系中选择满足特定条件的元组。例如,查询可以找出薪水超过23,000的工程师的姓名、公司和薪水,或者找出在特定公司工作且城市为特定值的工程师等。" 114168175,10294657,Java笔试精选:9道必考选择题解析,"['Java面试题', 'Java基础', '编程概念']
摘要由CSDN通过智能技术生成

数据库中元组关系演算

Tuple Relational Calculus is a non-procedural and declarative query language. The declarative query procedure gives logical condition which is required to be satisfied by the results. In the non-procedural query language, the user always tries to find out the details of how to get the results. Tuple Relational Calculus explains what to do by describing query but not explain how to do by does not provide the methods to solve.

元组关系演算是一种非过程性和声明性查询语言。 声明性查询过程给出了结果必须满足的逻辑条件。 在非过程查询语言中,用户始终尝试查找如何获取结果的详细信息。 元组关系演算通过描述查询来解释做什么,但没有解释如何做则没有提供解决方法。

Tuple Relational Calculus in a relation is specified in the selection of tuples with details. In relation, the tuples are used by filtering variables. The result which comes out as a resultant relation can have one or more than one tuples in a resultant relation. It is easy to use by someday who is not a skilled person also. Tuple variable which integrated with a relation is called the range relation.

在选择具有详细信息的元组时,指定了关系中的元组关系演算 。 相对地,元组通过过滤变量来使用。 作为结果关系得出的结果在结果关系中可以具有一个或多个元组。 也有一天不是技术人员也容易使用。 与关系集成的元组变量称为范围关系。

In Tuple Calculus, the notation of a query is:

在Tuple Calculus中,查询的符号为:

 {T | P (T)}   or {T | Condition (T)}   

Where,

哪里,

  • T = resulting tuples,

    T =结果元组,

  • P(T) = called as Predicate and It is a condition which is used to fetch T.

    P(T) =称为谓词,它是用于获取T的条件

Example

Table 1: Engineer

表1:工程师

Engineer Name AddressCity
RaghavA23/B6Mumbai
Sameer567/453Delhi
Sujata543/27Kanpur
ShivaniD35Jaipur
AmarB82/78Kolkata
工程师姓名 地址
拉加夫 A23 / B6 孟买
沙美尔 567/453 新德里
Sujata 543/27 坎普尔
西瓦尼 D35 斋浦尔
阿玛 B82 / 78 加尔各答

Table 2: Company

表2:公司

Company City
WiproChennai
AccentureDelhi
InfosysBangalore
公司
威普罗 钦奈
埃森哲 新德里
信息系统 班加罗尔

Table 3: Salary

表3:薪金

Engineer Name CompanySalary
RaghavWipro24,000
SameerInfosys23,000
SujataAccenture25,000
ShivaniWipro27,000
AmarAccenture30,000
工程师姓名 公司 薪水
拉加夫 威普罗 24,000
沙美尔 信息系统 23,000
Sujata 埃森哲 25,000
西瓦尼 威普罗 27,000
阿玛 埃森哲 30,000

Table 4: Incentive + Bonus

表4:奖励+奖金

CompanyIncentive + Bonus
Wipro4,000
Accenture5,000
Infosys7,000
公司 激励+奖金
威普罗 4,000
埃森哲 5,000
信息系统 7,000

Table 5: Salary (Included Incentive + Bonus)

表5:薪金(包括奖励+奖金)

Engineer Name CompanySalary
RaghavWipro28,000
SameerInfosys30,000
SujataAccenture30,000
ShivaniWipro31,000
AmarAccenture35,000
工程师姓名 公司 薪水
拉加夫 威普罗 28,000
沙美尔 信息系统 30,000
Sujata 埃森哲 30,000
西瓦尼 威普罗 31,000
阿玛 埃森哲 35,000

Query 1: Find the Engineer Name, Company and Salary of those whose salaries are greater than 23,000 excluded Incentive + Bonus.

查询1:找到薪金高于23,000(不含激励和奖金)的工程师的姓名,公司和薪水。

{T| T ∈ Engineer ∧ T [Salary]>= 23,000}

The Resultant relation is:

结果关系为:

Engineer Name CompanySalary
RaghavWipro24,000
SujataAccenture25,000
ShivaniWipro27,000
AmarAccenture30,000
工程师姓名 公司 薪水
拉加夫 威普罗 24,000
Sujata 埃森哲 25,000
西瓦尼 威普罗 27,000
阿玛 埃森哲 30,000

In the above query, The T [Salary] is called as Tuple variable.

在上面的查询中,T [Salary]被称为Tuple变量。

Query 2: Find the Engineer Name of all the Company whose salaries are less than 27,000 excluded Incentive + Bonus.

查询2:查找所有薪水少于27,000(不含激励和奖金)的公司的工程师名称。

{T| ∃ S ∈ Engineer ( T[Company] = S[Company]
∧ S [Salary]< 27,000)}

The Resultant relation is:

结果关系为:

Engineer Name
Raghav
Sameer
Sujata
工程师姓名
拉加夫
沙美尔
Sujata

Query 3: Find the Engineer Name of those who works in Accenture and their cities are Kanpur and Kolkata.

问题3:找到在埃森哲工作的工程师的名字,他们的城市是坎普尔和加尔各答。

{T| ∃ S ∈ Engineer (T [Engineer Name]) = S[Engineer Name])
∧∃ U ∈ Salary (T [Engineer Name] = U [Engineer Name])}

The Resultant relation is:

结果关系为:

Engineer Name
Sujata
Amar
工程师姓名
Sujata
阿玛

Query 4: Find the Engineer Name of those whose salaries included incentive + Bonus is "30,000" and their cities are Delhi and Kanpur.

查询4:找到薪金中包含奖励+奖金为“ 30,000”且其城市为德里和坎普尔的工程师的姓名。

{T | ∃ S ∈ Engineer (T [City] = S[City]
∧  ∃ U ∈ Salary(Included Incentive + Bonus)(U[Salary] = "30,000"  
∧ U[Engineer Name] = S[Engineer Name] ) ) }

The Resultant relation is:

结果关系为:

Engineer Name
Sameer
Sujata
工程师姓名
沙美尔
Sujata

翻译自: https://www.includehelp.com/dbms/tuple-relational-calculus.aspx

数据库中元组关系演算

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值