COMPUTER SCIENCE DATA BASE CONCEPTS

2001

5.c) Explain Cartesian product of two relations.

Ans: The Cartesian product is a binary operation and is denoted by a cross(x). The Cartesian product of two relations A and B is written as AXB. The Cartesian product yields a new relationwhich has a degree (number of attributes) equal to the sum of the degrees of the two relations operated upon. The number of typles (cardinality) of the new relation is the product of the number of tuples of the two relations operated upon. The Cartesian product of two relations yields a relation with all possible combinations of the tuples of the two relations operated upon. All tuples of first relation are concatenated with all the tuples of second realtion to form the tuples of the new relation.

Eg: There are two relations as follows:

Relation 1: Student

Student Number Student Name Hosteler
1 Ravi Y
2 Robert N
3 Raheem Y

Relation 2: Instructor

Instructor Name Subject
K.Suman Computer Science
P.Pavan Electronics

The Cartesian product of these two relations, Student X Instructor, will yield a relation that have a degree of 5(3+2:sum of degrees of Student and Instructor) and a cardinality 6 (3 X 2: Product of cardinalities of two relations). The resulting relation is as follows

Student Number Student Name Hosteler Instruct or Name Subject
1 Ravi Y K.Suman Computer Science
1 Ravi Y P.Pavan Electronics
2 Robert N K.Suman Computer Science
2 Robert N P.Pavan Electronics
3 Raheem Y K.Suman Computer Science
3 Raheem Y P.Pavan Electronics

The resulting relation contains all possible combinations of tuples of the two relations.

1998:

5.a) What is a relation? What is the difference between a tuple and an attribute?

Ans: In relational data model, the data is organized into table (rows and columns). These tables are called relations. A row in a table represents a relationship among a set of values.Rows of the relations are called as tuples and columns of the relations are called as attributes.

 

CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )