Relational Algebra: Using PROJECTION to Select Only Certain Columns
In relational algebra, the operation used when you are interested in only certain columns (attributes) of a table is PROJECTION (option (i)).
A common way to remember this is:
- SELECTION keeps all columns but selects rows that satisfy a condition.
- PROJECTION keeps only specified columns (attributes) but selects all rows’ values for those columns.
- UNION combines results of two relations with the same schema, not columns-selection.
- JOIN combines two tables based on related rows (not “pick columns from one table” by itself).
Footnotes
-
(Encyclopedia of Database Systems / relational algebra concept; projection definition) - https://en.wikipedia.org/wiki/Relational_algebra - Projection returns specified columns (attributes). ↩ ↩2
-
https://en.wikipedia.org/wiki/Relational_algebra - Selection filters tuples (rows) by a predicate. ↩
-
https://en.wikipedia.org/wiki/Relational_algebra - Union combines tuples from two relations with compatible schemas. ↩
-
https://en.wikipedia.org/wiki/Relational_algebra - Join combines tuples from two relations based on a condition. ↩
Relational Algebra (Projection, Selection, Join) - Educational Overview
Mapping each option to its purpose
Below is a direct conceptual match to the question (“only certain columns”):
| Option | Operation | Typical intent | Matches “only certain columns”? |
|---|---|---|---|
| (i) | PROJECTION | choose specific attributes (columns) | ✅ Yes |
| (ii) | SELECTION | choose specific tuples (rows) by condition | ❌ No |
| (iii) | UNION | combine two relations’ tuples (compatible schema) | ❌ No |
| (iv) | JOIN | combine tuples from two relations by a condition | ❌ No |
Key idea: Projection is the column-pruning operator in relational algebra.
Footnotes
-
(Encyclopedia of Database Systems / relational algebra concept; projection definition) - https://en.wikipedia.org/wiki/Relational_algebra - Projection returns specified columns (attributes). ↩
How to decide which relational algebra operator to use
- 1Step 1
If the question says “only certain columns / attributes,” you should think PROJECTION. If it says “rows satisfying a condition,” think SELECTION.
- 2Step 2
“Only certain columns” → PROJECTION; “where/condition” → SELECTION.
- 3Step 3
If the task is about combining multiple tables, consider JOIN. If it’s about combining results from two compatible relations, consider UNION.
Pro Tip
"A fast memory trick: SELECTION = selection of rows, PROJECTION = projection of columns."2
Footnotes
-
(Encyclopedia of Database Systems / relational algebra concept; projection definition) - https://en.wikipedia.org/wiki/Relational_algebra - Projection returns specified columns (attributes). ↩
-
https://en.wikipedia.org/wiki/Relational_algebra - Selection filters tuples (rows) by a predicate. ↩
Common confusion
"Students often mix up SELECTION and PROJECTION: selection filters rows (keeps schema), while projection reduces the schema by keeping only chosen columns. They are different operators."2
Footnotes
-
(Encyclopedia of Database Systems / relational algebra concept; projection definition) - https://en.wikipedia.org/wiki/Relational_algebra - Projection returns specified columns (attributes). ↩
-
https://en.wikipedia.org/wiki/Relational_algebra - Selection filters tuples (rows) by a predicate. ↩
Mini examples (conceptual)
Let be a relation.
- Projection onto and (columns only) returns a relation with schema .
- Selection with predicate (e.g., ) returns tuples that satisfy the predicate but keeps schema .
These behaviors are standard definitions of projection vs. selection in relational algebra.2
Footnotes
-
(Encyclopedia of Database Systems / relational algebra concept; projection definition) - https://en.wikipedia.org/wiki/Relational_algebra - Projection returns specified columns (attributes). ↩
-
https://en.wikipedia.org/wiki/Relational_algebra - Selection filters tuples (rows) by a predicate. ↩
Operator selection reasoning (from question to operator)
Read the prompt carefully
Step 1Look for language like “only certain columns/attributes” or “rows that satisfy…”"
Choose by target
Step 2Columns → PROJECTION; Rows → SELECTION"
Sanity-check against UNION/JOIN
Step 3If nothing mentions combining two relations, UNION/JOIN usually do not fit."
Quick FAQ
Knowledge Check
Which relational algebra operation is used when we are interested in only certain columns of a table?