选择操作和项目操作有什么区别

发布于 2024-10-26 18:18:10 字数 98 浏览 2 评论 0原文

我在这里指的是基本的关系代数运算符。
在我看来,所有可以用project 完成的事情都可以用select 完成。

我不知道是否存在差异或我错过了某些细微差别。

I'm referring to the basic relational algebra operators here.
As I see it, everything that can be done with project can be done with select.

I don't know if there is a difference or a certain nuance that I've missed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

跨年 2024-11-02 18:18:10

PROJECT 消除列,而 SELECT 消除行。

PROJECT eliminates columns while SELECT eliminates rows.

恬淡成诗 2024-11-02 18:18:10

选择操作:此操作用于从指定给定逻辑的表(关系)中选择行,该逻辑称为谓词。谓词是用户定义的条件,用于选择用户选择的行。

项目操作:如果用户有兴趣选择几个属性的值,而不是选择表(关系)的所有属性,那么应该选择PROJECT操作。

查看更多内容:关系代数及其运算

Select Operation : This operation is used to select rows from a table (relation) that specifies a given logic, which is called as a predicate. The predicate is a user defined condition to select rows of user's choice.

Project Operation : If the user is interested in selecting the values of a few attributes, rather than selection all attributes of the Table (Relation), then one should go for PROJECT Operation.

See more : Relational Algebra and its operations

℉服软 2024-11-02 18:18:10

在关系代数中,“选择”和“投影”是不同的操作,但 SQL SELECT 将这些操作组合在单个语句中。

Select 检索关系(表)中“谓词”部分(WHERE 子句)中的条件成立的元组(行)。

项目检索指定的属性(列)。

以下 SQL SELECT 查询:

select field1,field2 from table1 where field1 = 'Value';

是关系代数的投影和选择操作的组合。

In Relational algebra 'Selection' and 'Projection' are different operations, but the SQL SELECT combines these operations in a single statement.

Select retrieves the tuples (rows) in a relation (table) for which the condition in 'predicate' section (WHERE clause) stands true.

Project retrieves the attributes (columns) specified.

The following SQL SELECT query:

select field1,field2 from table1 where field1 = 'Value';

is a combination of both Projection and Selection operations of relational algebra.

浪推晚风 2024-11-02 18:18:10

项目不是一个声明。这是 select 语句的能力。
Select 语句具有三种功能。它们是选择、投影、连接。选择 - 它检索满足给定查询的行。
投影 - 它选择给定查询满足的列。
Join-it 连接两个或多个表

Project is not a statement. It is the capability of the select statement.
Select statement has three capabilities. They are selection,projection,join. Selection-it retrieves the rows that are satisfied by the given query.
Projection-it chooses the columns that are satisfied by the given query.
Join-it joins the two or more tables

暖心男生 2024-11-02 18:18:10

Project 将影响表中的列,而 Select 将影响行。另一方面 Project 用于选择具有特定属性的列,而不是选择所有列数据

Project will effects Columns in the table while Select effects the Rows. on other hand Project is use to select the columns with specefic properties rather than Select the all of columns data

不甘平庸 2024-11-02 18:18:10

选择操作用于从满足选择条件的关系中选择元组的子集,它过滤掉满足条件的元组。选择操作可以可视化为水平划分为两组元组 - 满足条件的元组被选择,那些满足条件的元组被选择元组不选择条件被丢弃
西格玛 (R)
投影操作用于从满足选择条件的关系中选择一个属性。它仅过滤掉那些满足条件的元组。投影操作可以可视化为垂直划分为两部分 - 满足条件的部分被选择,其他部分被丢弃
Π(R)
属性列表是属性的数量

selection opertion is used to select a subset of tuple from the relation that satisfied selection condition It filter out those tuple that satisfied the condition .Selection opertion can be visualized as horizontal partition into two set of tuple - those tuple satisfied the condition are selected and those tuple do not select the condition are discarded
sigma (R)
projection opertion is used to select a attribute from the relation that satisfied selection condition . It filter out only those tuple that satisfied the condition . The projection opertion can be visualized as a vertically partition into two part -are those satisfied the condition are selected other discarded
Π(R)
attribute list is a num of attribute

不即不离 2024-11-02 18:18:10

选择具有某些条件的从关系中提取行,并项目从具有或不具有某些条件的关系中提取特定数量的属性/列。

Select extract rows from the relation with some condition and Project extract particular number of attribute/column from the relation with or without some condition.

梦回梦里 2024-11-02 18:18:10

关系代数中的投影运算符 (π) 和 SQL 中的 SELECT 关键字之间的区别在于,如果结果表/集合多次出现相同的元组,则 π 将仅返回其中之一,而 SQL SELECT 将返回全部。

The difference between the project operator (π) in relational algebra and the SELECT keyword in SQL is that if the resulting table/set has more than one occurrences of the same tuple, then π will return only one of them, while SQL SELECT will return all.

离线来电— 2024-11-02 18:18:10

select 仅更改结果表的基数,但 Project 确实会更改关系程度和基数。

select just changes cardinality of the result table but project does change both degree of relation and cardinality.

淡写薰衣草的香 2024-11-02 18:18:10

区别在于关系代数中,项目影响列,而选择影响行。然而在查询语法中,select 就是这个词。没有项目这样的查询。
假设有一个名为 users 的表,有数十万条记录(行),该表有 6 个字段(userID、Fname、Lname、age、pword、salary)。假设我们想要限制对敏感数据(用户 ID、密码和工资)的访问,并限制要访问的数据量。在mysql maria DB中,我们创建一个视图如下(Create view user1 as select Fname,Lname,age from users limit 100;)从我们发出的视图(select Fname from users1;)。该查询既是一个选择又是一个项目

The difference come in relational algebra where project affects columns and select affect rows. However in query syntax, select is the word. There is no such query as project.
Assuming there is a table named users with hundreds of thousands of records (rows) and the table has 6 fields (userID, Fname,Lname,age,pword,salary). Lets say we want to restrict access to sensitive data (userID,pword and salary) and also restrict amount of data to be accessed. In mysql maria DB we create a view as follows ( Create view user1 as select Fname,Lname, age from users limit 100;) from our view we issue (select Fname from users1;) . This query is both a select and a project

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文