What is projection operation in DBMS?

Projection operation (represented by ππ) belongs to relational algebra, which displays the specific column of a table mentioned in the query. It is a unary operationUnary operations are those which operate on one relation only. that returns its argument relation, with certain attributes left out.

Syntax

The syntax of projection is as follows:

Where A1 and A2 are attribute names and rr is a relation name.

The result is defined as the relation of kk columns obtained by erasing the columns that are not listed. It produces the output by removing the duplicate tuples from the table since relations are sets and sets do not have duplicates.

Example

Consider the following table (named Instructors) on which the projection operation would be applied:

Instructors

ID

Name

Salary

10101

Addie

65000

12121

Bob

52000

22222

John

70000

44444

Mary

40000

If we want to get only the "Salary" column from the "Instructors" table, we'll perform the following command:

The above command would produce the following results:

Salary

65000

52000

70000

40000

Similarly, we can also project multiple columns from the table. If we want to display ID and their respective name (eliminate the "Salary" column), we'll perform the following operation:

The command would produce the following output:

ID

Name

10101

Addie

12121

Bob

22222

John

44444

Mary

Projection operation in SQL

SELECT ID, Name
FROM Instructors

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved