Cartesian product and division

The Cartesian product (schema, number of tuples, link with the join) and relational division, which answers questions of the “those associated with all” kind: computing it and recognising the question that calls for it.

  • 24 cards
  • 4 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. The numbers

A few cards from the deck

  • Cartesian product (R × S): what is it?

    Show the answer

    The relation in which each tuple places a tuple of R beside a tuple of S, for every possible pair.

    Its degree is the sum of the degrees and its cardinality the product of the cardinalities: 3 tuples × 6 tuples give 18 tuples.

  • What is the result of INSCRIT ÷ MODULE?

    ```text
    INSCRIT(etudiant, module)
    Léa BD
    Léa Web
    Léa Reseau
    Tom BD
    Tom Web
    Sam BD
    Sam Reseau
    Zoé BD
    Zoé Web
    Zoé Reseau
    Zoé Maths

    MODULE(module)
    BD
    Web
    Reseau
    `

    • Léa and Zoé
    • Léa only
    • Léa, Tom, Sam and Zoé
    • Tom and Sam
    Show the answer

    Léa and Zoé

    Léa and Zoé are associated with BD, Web and Reseau. Tom lacks Reseau, Sam lacks Web. Zoé's enrolment in Maths, absent from MODULE, does not matter.

  • The Cartesian product R × S has as degree the … of the degrees and as cardinality the … of the cardinalities.

    Show the answer

    The Cartesian product R × S has as degree the sum of the degrees and as cardinality the product of the cardinalities.

    A product blows up quickly: 1,000 tuples × 1,000 tuples make a million, hence the danger of forgetting a join condition.

  • Division (R ÷ S): what is it?

    Show the answer

    The operator that returns the values of R associated with every tuple of S.

    INSCRIT ÷ MODULE returns the students enrolled in every module of MODULE. The “every” is what sets it apart from a join, where “at least one” is enough.