Explain Cartesian Product in Relational Algebra



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 −

RegNo Branch Section
1 CSE A
2 ECE B
3 CIVIL A
4 IT B

Table R2

Name RegNo
Bhanu 2
Priya 4

R1 X R2

RegNo Branch Section Name RegNo
1 CSE A Bhanu 2
1 CSE A Priya 4
2 ECE B Bhanu 2
2 ECE B Priya 4
3 CIVIL A Bhanu 2
3 CIVIL A Priya 4
4 IT B Bhanu 2
4 IT B Priya 4
Updated on: 2021-07-06T15:44:28+05:30

11K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements