数据库中关系代数是什么
Every database management system must define a query language to allow users to access the data stored in the database. Relational Algebra is a procedural query language used to query the database tables to access data in different ways.
每个数据库管理系统都必须定义一种查询语言,以允许用户访问存储在数据库中的数据。 关系代数是一种过程查询语言,用于查询数据库表以不同方式访问数据。
In relational algebra, input is a relation(table from which data has to be accessed) and output is also a relation(a temporary table holding the data asked for by the user).
在关系代数中,输入是一个关系(必须从中访问数据的表),而输出也是一个关系(一个保存用户要求的数据的临时表)。
Relational Algebra works on the whole table at once, so we do not have to use loops etc to iterate over all the rows(tuples) of data one by one. All we have to do is specify the table name from which we need the data, and in a single line of command, relational algebra will traverse the entire given table to fetch data for you.
关系代数可一次在整个表上工作,因此我们不必使用循环等来遍历数据的所有行(元组)。 我们要做的就是指定要从中获取数据的表名,并且在单行命令中,关系代数将遍历整个给定表以为您获取数据。
The primary operations that we can perform using relational algebra are:
我们可以使用关系代数执行的主要运算是:
Select
选择
Project
项目
Union
联盟
Set Different
设置不同
Cartesian product
笛卡尔积
Rename
改名
选择运算(σ) (Select Operation (σ))
This is used to fetch rows(tuples) from table(relation) which satisfies a given condition.
这用于从满足给定条件的表(关系)中获取行(元组)。
Syntax: σp(r)