Algebra Project Average ratng: 5,5/10 7353 votes

In relational algebra, a projection is a unary operation written as Πa1,...,an(R){displaystyle Pi _{a_{1},..,a_{n}}(R)} where a1,...,an{displaystyle a_{1},..,a_{n}} is a set of attribute names. The result of such projection is defined as the set obtained when the components of the tupleR{displaystyle R} are restricted to the set {a1,...,an}{displaystyle {a_{1},..,a_{n}}} – it discards (or excludes) the other attributes.[1]

In practical terms, it can be roughly thought of as picking a subset of all available columns. For example, if the attributes are (name, age), then projection of the relation {(Alice, 5), (Bob, 8)} onto attribute list (age) yields {5,8} – we have discarded the names, and only know what ages are present.

This project is designed for any algebra classroom. Students match the equation in standard form, in slope intercept form, the graph, the slope, and the y intercept for twelve problems. Subjects: Algebra. Grades: 8 th, 9 th. Types: Projects. Make a 4-page paper and short presentation demonstrating the use of linear algebra in lossy audio compression, the modified discrete cosine transform (MDCT). Here's an undergraduate research project that may get you quickly into the topic, which has taken on more appeal since MP3 players have dominated the market, fueled by low-cost.

In addition, projection can be used to modify an attribute's value: if relation R has attributes a, b, and c, and b is a number, thenΠa,b0.5,c(R){displaystyle Pi _{a, b*0.5, c}(R)}will return a relation nearly the same as R, but with all values for 'b' shrunk by half.[2]

Related concepts[edit]

The closely related concept in set theory (see: projection (set theory)) differs from that of relational algebra in that, in set theory, one projects onto ordered components, not onto attributes. For instance, projecting (3,7){displaystyle (3,7)} onto the second component yields 7.

Projection is relational algebra's counterpart of existential quantification in predicate logic. The attributes not included correspond to existentially quantified variables in the predicate whose extension the operand relation represents. The example below illustrates this point.

Because of the correspondence with existential quantification, some authorities prefer to define projection in terms of the excluded attributes. In a computer language it is of course possible to provide notations for both, and that was done in ISBL and several languages that have taken their cue from ISBL.

A nearly identical concept occurs in the category of monoids, called a string projection, which consists of removing all of the letters in the string that do not belong to a given alphabet.

When implemented in SQL standard the 'default projection' returns a multiset instead a set, and the π projection is obtained by the addition of the DISTINCT keyword to eliminate duplicate data.

Example[edit]

For an example, consider the relations depicted in the following two tables which are the relation Person and its projection on (some say 'over') the attributes Age and Weight:

Person{displaystyle {text{Person}}}ΠAge,Weight(Person){displaystyle Pi _{text{Age,Weight}}({text{Person}})}
NameAgeWeight
Harry34180
Sally28164
George28170
Helena54154
Peter34180
AgeWeight
34180
28164
28170
54154

Suppose the predicate of Person is 'Name is age years old and weighs weight.' Then the given projection represents the predicate, 'There exists Name such that Name is age years old and weighs weight.'

N gage games for s60v5. Note that Harry and Peter have the same age and weight, but since the result is a relation, and therefore a set, this combination only appears once in the result.

Nuovo cinema paradiso versione integrale torrent italia. More formally the semantics of projection are defined as follows:

Πa1,...,an(R)={t[a1,...,an]:tR}{displaystyle Pi _{a_{1},..,a_{n}}(R)={ t[a_{1},..,a_{n}]: tin R }}

where t[a1,...,an]{displaystyle t[a_{1},..,a_{n}]} is the restriction of the tuple t{displaystyle t} to the set {a1,...,an}{displaystyle {a_{1},..,a_{n}}} so that

t[a1,...,an]={(a,v)(a,v)t,a{a1,...,an}}{displaystyle t[a_{1},..,a_{n}]={ (a',v) (a',v)in t, a'in {a_{1},..,a_{n}}}}

where (a,v){displaystyle (a',v)} is an attribute value, a{displaystyle a'} is an attribute name, and v{displaystyle v} is an element of that attribute's domain — see Relation (database).

The result of a projection Πa1,...,an(R){displaystyle Pi _{a_{1},..,a_{n}}(R)} is defined only if {a1,...,an}{displaystyle {a_{1},..,a_{n}}} is a subset of the header of R{displaystyle R}.

Projection over no attributes at all is possible, yielding a relation of degree zero. In this case the cardinality of the result is zero if the operand is empty, otherwise one. The two relations of degree zero are the only ones that cannot be depicted as tables.

See also[edit]

References[edit]

  1. ^'Relational Algebra'. cs.rochester.edu. Retrieved 2014-07-28.
  2. ^http://www.csee.umbc.edu/~pmundur/courses/CMSC661-02/rel-alg.pdfSee Problem 3.8.B on page 3
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Projection_(relational_algebra)&oldid=922389711'