# Explain cartesian product in relational algebra (DBMS)?

Query is a question or requesting information. Query language is a language which is used to retrieve information from a database.

Query language is divided into two types −

• Procedural language

• Non-procedural language

## Procedural language

Information is retrieved from the database by specifying the sequence of operations to be performed.

For Example − Relational algebra.

Structure Query language (SQL) is based on relational algebra.

Relational algebra consists of a set of operations that take one or two relations as an input and produces a new relation as output.

## Types of Relational Algebra operations

The different types of relational algebra operations are as follows −

• Select operation

• Project operation

• Rename operation

• Union operation

• Intersection operation

• Difference operation

• Cartesian product operation

• Join operation

• Division operation

Union, intersection, difference, cartesian, join, division comes under binary operation (operate on two tables).

## Cartesian product operation

It combines R1 and R2 without any condition. It is denoted by X.

Degree of R1 XR2 = degree of R1 + degree of R2

{degree = total no of columns}

### Example

Consider R1 table −

RegNoBranchSection
1CSEA
2ECEB
3CIVILA
4ITB

NameRegNo
Bhanu2
Priya4

### R1 X R2

RegNoBranchSectionNameRegNo
1CSEABhanu2
1CSEAPriya4
2ECEBBhanu2
2ECEBPriya4
3CIVILABhanu2
3CIVILAPriya4
4ITBBhanu2
4ITBPriya4

Updated on: 06-Jul-2021

8K+ Views

##### Kickstart Your Career

Get certified by completing the course

Advertisements