1D0-541 practice question 22 of 25

Which relational algebraic operation is used to select specific columns (attributes) from a relation?

Full set: 128 questions
Answer options
A: Union
B: Difference
C: Projection Correct answer
D: Intersection
Correct Answer:
C. Projection
Explanation

In relational algebra, the Projection operation (denoted by π) is used to select a subset of attributes (columns) from a relation (table). It creates a new relation containing only the specified columns from the original relation, and duplicate rows are eliminated. For example, if a Customer relation has columns for ID, Name, and City, a projection on Name and City would produce a new table with just those two columns. This operation is fundamental for retrieving only the necessary data fields from a table, which is a common requirement in database queries.

Why Incorrect

A. Union: This operation combines all rows from two compatible relations into a single relation. It operates on rows, not columns.
B. Difference: This operation returns rows that exist in the first relation but not in the second. It is a set-based row operation.
D. Intersection: This operation returns only the rows that are present in both of the specified relations. It also operates on rows.

References

1. Silberschatz, A., Korth, H. F., & Sudarshan, S. (2019). Database System Concepts (7th ed.). McGraw-Hill. In Chapter 2, Section 2.4.3 "The Projection Operation," it states, "The projection operation is a unary operation that returns its argument relation with certain attributes left out... The projection operation selects certain columns from a table and discards the other columns."

2. Ullman, J. D., & Widom, J. (2008). A First Course in Database Systems (3rd ed.). Pearson/Prentice Hall. Chapter 2, Section 2.3.2 "Projection," defines the operation as: "The projection operator, π, is used to produce from a relation a new relation that has a subset of the original relation’s columns."

3. Stanford University. (n.d.). CS145 Introduction to Databases, Relational Algebra. Retrieved from Stanford University courseware. In the section "Basic Operators," Projection (π) is defined as the operation that "selects columns from a relation." (https://web.stanford.edu/class/cs145/notes/relalg/relalg.html)

Scroll to Top