What is a Projection?

DaveDev picture DaveDev · Aug 11, 2010 · Viewed 41.5k times · Source

What is a Projection, in terms of database theory and NHibernate when using SetProjection()?

Answer

nvogel picture nvogel · Aug 11, 2010

Projection is one of the basic operations of Relational Algebra. It takes a relation and a (possibly empty) list of attributes of that relation as input. It outputs a relation containing only the specified list of attributes with duplicate tuples removed. In other words the output must also be a relation.

Example, if the relation R{A,B}, contains three tuples {1,10},{2,10},{3,20} then the projection of R over the attribute list {B} would contain 2 tuples: {10},{20}.

In short, projection is more or less equivalent to SELECT DISTINCT in SQL (excluding cases with nulls and duplicate columns).