0:00

Now, we're going to talk about the Cartesian Product operator in relation to algebra.

Â So, the mathematical definition of it,

Â is that you have again two relations,

Â r and s. And you refer to the Cartesian Product with this symbol.

Â So the idea is that,

Â Cartesian Product what it does is that it takes every tuple in

Â relation r and combine it with every single tuple in

Â relations and the final product of the Cartesian product operator is

Â basically all the tuples combined together from both relations r and s. So,

Â let's take a look at an example.

Â So, let's assume you want to do a Cartesian Product between the cse courses.

Â So, all the courses in computer science and the cse professors.

Â So, you want to list all combinations of

Â computer science professors teaching computer science courses.

Â So, you want to just mix and match

Â the combination between professors and computer science courses.

Â So, the final schema is usually the schema,

Â it's the combination of the schema of the relation r and relation s. So, as you can see,

Â the output has the name and the office

Â which is the name of the professor and the office of the professor,

Â and also the other part of the schema has the course ID and the course title.

Â So, you combined the two schemas of

Â the two relations together to find for the Cartesian Product.

Â So, if you look at the example again,

Â so you have cse_profs that's

Â a relation that has the information about computer science professors.

Â We have name of professor1,

Â professor2 and we have the office of the professor.

Â And then, the other relation which is cse_courses.

Â It has the course ID and course title.

Â So, for all the computer science courses.

Â And the Cartesian Product of these two,

Â so, cse_ profs and cse_courses.

Â It basically combines all these tuples

Â from both relations together and combine the schema as well.

Â So, the output will be like that.

Â So, here you have the schema of the cse_profs,

Â then you have the schema of the cse_courses.

Â And then, these are the tuples combined altogether and to combine all of them together,

Â you have to find all the combinations between professor,

Â s and professors' tuples, and courses tuples.

Â So, in the professor tuples,

Â we have only Prof1 and Prof2.

Â But, to find all the combination we have to combine Prof1 with CSE412, CSE513, CSE514.

Â And then, do the same for Prof2.

Â So, this is why we have

Â several professor tuples that has Prof1 and several tuples that have Prof2.

Â So, and this is the final output of

Â the Cartesian Product between csc_prof and csc_courses. Thank you.

Â