Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Select and Project Operations

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.

like image 560
gizgok Avatar asked Mar 25 '11 12:03

gizgok


People also ask

What is select and project operation in relational algebra?

Prerequisite – Relational Algebra. Project operation selects (or chooses) certain attributes discarding other attributes. The Project operation is also known as vertical partitioning since it partitions the relation or table vertically discarding other columns or attributes. Notation: πA(R)

What does a select operation do?

The SELECT operation is used for selecting a subset of the tuples according to a given selection condition. Sigma(σ)Symbol denotes it. It is used as an expression to choose tuples which meet the selection condition. Select operator selects tuples that satisfy a given predicate.

What is SQL operations project?

Project Operation The project SQL operation allows users of the relational model to retrieve column-specific data from a table. This data is then used to create a new table that is dedicated to the information that the user would like to see.

What is the select operator?

The selection operator is unary, which means it is applied to one table at a time. The result is a new table that has the same structure as the original. The operation takes rows from the original table that satisfy a specified condition, called the selection condition, producing a horizontal subset of the table.


3 Answers

PROJECT eliminates columns while SELECT eliminates rows.

like image 185
Krishna Pal Avatar answered Oct 08 '22 02:10

Krishna Pal


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

like image 33
Saurabh Gokhale Avatar answered Oct 08 '22 01:10

Saurabh Gokhale


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.

like image 28
EmergeStronger Avatar answered Oct 08 '22 02:10

EmergeStronger