What is the difference between Select and Project

2019-01-31 18:56发布

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.

10条回答
迷人小祖宗
2楼-- · 2019-01-31 19:12

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

查看更多
Viruses.
3楼-- · 2019-01-31 19:17

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.

查看更多
霸刀☆藐视天下
4楼-- · 2019-01-31 19:18

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.

查看更多
叼着烟拽天下
5楼-- · 2019-01-31 19:19

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.

查看更多
成全新的幸福
6楼-- · 2019-01-31 19:22

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

查看更多
看我几分像从前
7楼-- · 2019-01-31 19:28

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

查看更多
登录 后发表回答