$30 off During Our Annual Pro Sale. View Details »

Relational Playground: Teaching the Duality of Relational Algebra and SQL

Relational Playground: Teaching the Duality of Relational Algebra and SQL

Students in introductory data management courses are often taught how to write queries in SQL. This is a useful and practical skill, but it gives limited insight into how queries are processed by relational database engines. In contrast, relational algebra is a commonly used internal representation of queries by database engines, but can be challenging for students to grasp. We developed a tool we call Relational Playground for database students to explore the connection between relational algebra and SQL.

Michael Mior

June 23, 2023
Tweet

More Decks by Michael Mior

Other Decks in Education

Transcript

  1. Michael Mior
    Relational Playground
    Teaching the Duality of Relational
    Algebra and SQL

    View Slide

  2. • Relational Algebra and SQL
    • Query Optimization
    • Demo
    • Future Work

    View Slide

  3. Context
    ▸ Introductory courses in databases
    (big data) for grads and undergrads
    ▸ Relational algebra is taught first,
    followed by SQL
    ▸ Students are expected to know how to
    convert between the two
    3

    View Slide

  4. Relational
    Algebra
    ▸ Gives a better intuition for how queries
    are executed by the database
    ▸ Important for understanding query
    optimization
    ▸ Enabling students to experiment
    provides an infinite source of examples
    4

    View Slide

  5. SQL
    ▸ Many students come with some
    knowledge of SQL
    ▸ Most students will likely be writing SQL
    ▸ Being able to connect this with
    relational algebra improves
    understanding of query execution
    5

    View Slide

  6. Relational
    Playground
    ▸ Currently Relational Playground
    supports SELECT, JOIN, WHERE, and
    ORDER BY
    ▸ Relational Playground provides a single
    implementation for each operator
    ▸ All queries are executed completely in
    the browser (there is no backend)
    6

    View Slide

  7. Query
    optimization
    Start with a “canonical” relational algebra
    representation:
    1. Join all tables in the query
    2. Apply any filtering
    3. Sort the results
    4. Project the final set of columns
    7

    View Slide

  8. Future
    Work
    ▸ Additional operators and expanded
    query support
    ▸ More query optimizations
    ▸ Explainable query execution
    ▸ Detailed student evaluations
    8

    View Slide

  9. Demo
    relationalplayground.com

    View Slide

  10. View Slide

  11. View Slide

  12. View Slide

  13. Acknowledgements
    Carson
    Bloomingdale
    Aryan Jha

    View Slide

  14. Questions?
    relationalplayground.com

    View Slide