Select和Project Operations之间有什么区别

时间:2021-07-30 07:27:52

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.

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

What do folks @ SO think

人们对SO的看法是什么?

10 个解决方案

#1


38  

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.

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

See more : Relational Algebra and its operations

查看更多:关系代数及其操作

#2


29  

PROJECT eliminates columns while SELECT eliminates rows.

PROJECT消除列,而SELECT消除行。

#3


14  

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

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

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

Select检索关系(表)中的元组(行),其中'predicate'部分(WHERE子句)中的条件为true。

Project retrieves the attributes (columns) specified.

Project检索指定的属性(列)。

The following SQL SELECT query:

以下SQL SELECT查询:

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

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

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

#4


6  

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

项目不是声明。它是select语句的功能。 Select语句有三个功能。他们是选择,投影,加入。选择 - 它检索给定查询满足的行。投影 - 它选择给定查询满足的列。 Join-it加入两个或多个表

#5


1  

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

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

#6


1  

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

项目将影响表格中的列,而选择效果行。另一方面,Project用于选择具有specefic属性的列而不是Select the all of columns data

#7


0  

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.

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

#8


0  

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.

关系代数中的项目运算符(π)与SQL中的SELECT关键字之间的区别在于,如果生成的表/集具有多个相同元组的出现次数,则π将仅返回其中一个,而SQL SELECT将返回所有。

#9


0  

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

选择只更改结果表的基数,但项目确实改变了关系度和基数。

#10


0  

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

不同之处在于关系代数,其中项目影响列并选择影响行。但是在查询语法中,select是单词。项目没有这样的查询。假设有一个名为users的表,其中包含数十万条记录(行),该表有6个字段(userID,Fname,Lname,age,pword,salary)。假设我们希望限制对敏感数据(userID,pword和salary)的访问,并限制要访问的数据量。在mysql maria DB中,我们创建一个视图如下(创建视图user1作为选择Fname,Lname,年龄从用户限制100;)从我们的视图中我们发出(从users1中选择Fname;)。此查询既是选择又是项目

#1


38  

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.

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

See more : Relational Algebra and its operations

查看更多:关系代数及其操作

#2


29  

PROJECT eliminates columns while SELECT eliminates rows.

PROJECT消除列,而SELECT消除行。

#3


14  

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

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

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

Select检索关系(表)中的元组(行),其中'predicate'部分(WHERE子句)中的条件为true。

Project retrieves the attributes (columns) specified.

Project检索指定的属性(列)。

The following SQL SELECT query:

以下SQL SELECT查询:

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

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

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

#4


6  

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

项目不是声明。它是select语句的功能。 Select语句有三个功能。他们是选择,投影,加入。选择 - 它检索给定查询满足的行。投影 - 它选择给定查询满足的列。 Join-it加入两个或多个表

#5


1  

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

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

#6


1  

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

项目将影响表格中的列,而选择效果行。另一方面,Project用于选择具有specefic属性的列而不是Select the all of columns data

#7


0  

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.

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

#8


0  

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.

关系代数中的项目运算符(π)与SQL中的SELECT关键字之间的区别在于,如果生成的表/集具有多个相同元组的出现次数,则π将仅返回其中一个,而SQL SELECT将返回所有。

#9


0  

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

选择只更改结果表的基数,但项目确实改变了关系度和基数。

#10


0  

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

不同之处在于关系代数,其中项目影响列并选择影响行。但是在查询语法中,select是单词。项目没有这样的查询。假设有一个名为users的表,其中包含数十万条记录(行),该表有6个字段(userID,Fname,Lname,age,pword,salary)。假设我们希望限制对敏感数据(userID,pword和salary)的访问,并限制要访问的数据量。在mysql maria DB中,我们创建一个视图如下(创建视图user1作为选择Fname,Lname,年龄从用户限制100;)从我们的视图中我们发出(从users1中选择Fname;)。此查询既是选择又是项目