A Better SQL in 11 Lines of Code

UCLA's RePL lab introduces Prela, a query language built on binary relations. This tutorial shows how to implement a toy version in Python, revealing that complex SQL joins can be expressed as simple relation compositions. By decomposing tables into two-column relations and using operators like `.select`, `&`, and `.where`, Prela composes queries that read like natural language. The result: a 20-line SQL query becomes an 11-line Prela expression, with the added benefit of composability and clarity.

The first special thing about Prela is that there are only binary relations, i.e., tables with two columns.

More from this day

2026-08-29