Projection (π) is a relational‑algebra operation that selects specific columns (attributes) from a relation. It is denoted by the Greek letter pi (π) and works like a SELECT clause in SQL that lists only required columns.
In simple terms, the projection operation returns a new relation that contains only the specified attributes, effectively hiding the other columns while keeping the same rows (up to duplicates).
Syntax and Meaning
The general syntax is:
: the input relation (table).
: the list of attributes you want to keep.
The result is a relation with only those attributes and all the rows from the original table, but with duplicate tuples removed because relational algebra treats relations as sets.
Example for Clarity
Consider a relation EMPLOYEE(emp_id, name, age, salary, dept).
If we want only names and salaries, we write:
The output table will have columns name and salary only, with all employee entries, but any duplicate combinations of name and salary will appear only once.
Key Properties of Projection
Projection removes unwanted attributes but keeps all the tuples that exist in the original relation (after removing duplicates).
It reduces the width of the table (fewer columns) but not necessarily the length (number of rows).
Projection is not commutative with most other operations because the order of attributes in the schema matters.
Why Projection Matters?
It is the basic way to restrict the view of a table to only relevant columns.
It helps in reducing data size and improving query efficiency when full rows are not needed.
It corresponds directly to column‑selection in SQL (
SELECT name, salary FROM EMPLOYEE), making it essential for beginners.
By mastering projection, students learn how databases can expose only part of a table’s structure, which is crucial for designing user‑friendly interfaces and efficient queries.