RDBMS1.4

Unit-I Unit-II  Unit-III Unit-IVUnit-V
Part-I Part-II Part-I Part-IPart-ITotal
Part-III Part-IV Part-II Part-IIPart-II
Part-VPart-III


 9.     Explain Relational Operators In- Detail?

Ans:

Relational Operations

SELECT

The select operation is used to select some specific records from the database based on some criteria. This is a unary operation mathematically denoted as σ.

Syntax:

σ <Selection condition> (Relation)

The Boolean expression is specified in <Select condition> is made of a number of clauses of the form:

<attribute name><comparison operator><constant value>

or

<attribute name><comparison operator><attribute name>

Comparison operators in the set {,,,≠≥≤=, <, <} apply to the attributes whose domains are ordered value like integer.

Example :

Consider the relation PERSON. If you want to display details of persons having age less than or equal to 30 than the select operation will be used as follows:

σAGE <=30 (PERSON) 

The PROJECT operation

The project operation is used to select the records with specified attributes while discarding the others based on some specific criteria. This is denoted as Π.

Π List of attribute for project (Relation)

Example :

Consider the relation PERSON. If you want to display only the names of persons then the project operation will be used as follows:

Π Name (PERSON) 

The JOIN operation

The JOIN operation is applied on two relations. When we want to select related tuples from two given relation join is used. This is denoted as .

Syntax:

R1<join condition>R2 is used to combine related tuples from two relations R1 and R2 into a single tuple.

<join condition> is of the form:

<condition>AND<condition>AND…………..AND<condition>.

• Three types of joins are there:

a) Theta join

When each condition is of the form

A θ B

A is an attribute of R1 and B is an attribute of R2 and have the same domain, and θ is one of the comparison operators {=, <, <}. ,,,≠≥≤

b) Equijoin

When each condition appears with equality condition (=) only.

c) Natural join (denoted by R*S)

When two join attributes have the same name in both relations. (That attribute is called Join attribute), only one of the two attributes is retained in the join relation. The join condition in such a case is = for the join attribute. The condition is not shown in the natural join.

The DIVISION operation:

To perform the division operation R1÷R2, R2 should be a proper subset of R1.

In the following example R1 contains attributes A and B and R2 contains only attribute B so R2 is a proper subset of R1. If we perform R1÷R2 than the resultant relation will contain those values of A from R1 that are related to all values of B present in R2.

 




No comments:

Post a Comment