Reputation: 7649
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.
Upvotes: 46
Views: 148024
Reputation: 1
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
Upvotes: 0
Reputation: 1
select just changes cardinality of the result table but project does change both degree of relation and cardinality.
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 3725
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.
Upvotes: 0
Reputation: 4290
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
Upvotes: 2
Reputation: 131
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
Upvotes: 13
Reputation: 11
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
Upvotes: 1
Reputation: 351
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.
Upvotes: 35
Reputation: 46405
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
Upvotes: 65