Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

More Decks by Michael Mior

Other Decks in Education


  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. Future Work ▸ Additional operators and expanded query support ▸

    More query optimizations ▸ Explainable query execution ▸ Detailed student evaluations 8