# What Is Relational Algebra? Explain Its Operations

Relations are Sets,  Like relations in mathematics, a n-relation is a subset of the Cartesian product of n sets.  So all set operations: Union, intersection, difference, cross product (or Cartesian product)  are part of the algebra.  Also Select, Join, Project and Quotient.  Select takes the tuples of the relation that satisfies a predicate. For example select all tuples where the field age is less than 21. The usual notation is a lower case sigma with the condition as a subscript.  Project gives a new set, containing a subset of the  fields (also called attributes or columns), as in mathematics the pi letter is used for the operator with the list of fields sub scripted.  For example suppose you have the relation schema R(name,age,sex), i.e. A relation with the attributes name,age and sex.  If you just want to know how many males and females of each age are in the table (other name for a relation)  you may answer that question as follows:  Project {age,sex} R  The join operation allows you to build a new relation from two relations that share some attributes. The new one will have all the tuples of both relations (you may perform a cross product, then select all the tuples with the same values for the common attributes)  joined in a new tuple if their values in the common attributes are the same.  For example: The two relations R(name, age, sex) and Q(age,prime) may stand for a population of people to insure and Q the price of the primes depending on age. The table produced by (R join Q) has the columns  name, age, sex,prime.  This join is one called equijoin, because the selection criteria for the joined tuples is that their common attributes have the same value. A more general join operator exists.  The join operator is usually  denoted by a tie symbol (i.e. Two triangles touching a vertex like a tie bow)  The quotient operator selects tuples that match several rows with the divisor, is a kind of division, as the name suggests. It is represented by a dash with two points one above the other bellow the dash. The other used for division not /.  The Data Base book written by Ullmann is very good, there are many others, also many tutorials in the web, google relational algebra
thanked the writer. 