Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1(a). Find out the Cartesian product (A X B) of the given pairof sets. Marks: 5

ID: 3615241 • Letter: 1

Question

1(a). Find out the Cartesian product (A X B) of the given pairof sets.         Marks: 5

      A => Set of first letterof the names ofcountries        =     A = { P, U, I }   

      B => Set of numbers denotingUniversity numbers    =     B = {010, 011}  

1(b). Consider the table below:

                               Room Table

RoomNo

hotelNo

Type

price

10

001

A

100

15

002

B

50

20

002

C

50

25

003

A

150

    

Show the relation that will be produced by the followingrelational algebra operation:          

hotelNo ( price > 50(Room))                                                                           Marks:10

RoomNo

hotelNo

Type

price

10

001

A

100

15

002

B

50

20

002

C

50

25

003

A

150

Explanation / Answer

1(a). The Cartesian product (A X B) means the product of bothsets A and B in such a way that every element of A is made a pairof every other element of B. It is written by AxB, also note thathere A is written first so first element of every pair will belongto A and second to B. The product is shown below


AxB= { (P, 010), (P, 011), (U, 010), (U, 011), (I, 010), (I,011) }


1(b). hotelNo ( price > 50(Room))  


Here, first the operation in the brackets ( i.e.price > 50 (Room) ) will be performed. This isSelection operation and according to the given condition, it willgive us all the rows in which the price is greater than 50, i.e.the second and the last row of the table.


RoomNo

hotelNo

Type

price

10

001

A

100

25

003

A

150


Now, the outer operation (i.e. hotelNo called Projection) is performed on the table obtained above. Hereaccording to the given condition, the column named "hotelNo" haveto be shown. So, after performing this operation we get


hotelNo

001

003


So, the answer of the operations hotelNo (price > 50 (Room))   is


hotelNo

001

003


RoomNo

hotelNo

Type

price

10

001

A

100

25

003

A

150