# A Better SQL in 11 Lines of Code

> Hacker News story 49491544 · language: en · submitted 2026-08-29
> Web version: https://zeli.app/story/49491544
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 43 · by [remywang](<https://news.ycombinator.com/user?id=remywang>) · 💬 53
[original](<https://prela-lang.org/tutorial/>) · [HN discussion](<https://news.ycombinator.com/item?id=49491544>)

## Summary

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.

## Key quote

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

## HN discussion (53 comments)

### [petilon](<https://news.ycombinator.com/item?id=49494155>)

> The example is not particularly impressive. The SQL equivalent is much easier to understand, which means it is easier to maintain. Number of lines is not an interesting metric; understandability and maintainability are more important.

### [remywang](<https://news.ycombinator.com/item?id=49493171>)

> Author here, I will be at VLDB in Boston this coming week and will be very happy to chat about Prela.
>
> Unrelated, we also have a tutorial on instance-optimal join algorithms: https://www.vldb.org/2026/program.html#tut-2

### [grebc](<https://news.ycombinator.com/item?id=49493400>)

> You’ve got do a better job selling the title sorry.
>
> I feel like the separation between a query & the query execution plan is one of the benefits of SQL. I trust the database system to do the right thing 99% of the time, and I don’t want to think about that either really.

### [slowcache](<https://news.ycombinator.com/item?id=49492693>)

> I think an important benefit of a good ORM is to reduce the translations that you have to do between your mental model of the data and what you are trying to do with the data.
>
> Before I started working a lot with SQL, ORMs fit my mental model better since I was more used to imperative programming languages and I thought they were easier to work with.
>
> Now that I am very comfortable with SQL, I have to translate an ORM into the SQL that it would produce. So now they just add another step in between me and the data

### [Planktonne](<https://news.ycombinator.com/item?id=49492940>)

> This seems harder to read than SQL, and only less verbose if you assume that an SQL database would be built with Prela's limitations in mind, which doesn't feel like a reasonable assumption.

---

## Cite

- Page: https://zeli.app/story/49491544
- Date: 2026-08-29
- Source: prela-lang.org (https://prela-lang.org/tutorial/)
- Hacker News: https://news.ycombinator.com/item?id=49491544

## Other languages

- zh: https://zeli.app/zh/story/49491544 · markdown: https://zeli.app/zh/story/49491544.md
- ja: https://zeli.app/ja/story/49491544 · markdown: https://zeli.app/ja/story/49491544.md
- ko: https://zeli.app/ko/story/49491544 · markdown: https://zeli.app/ko/story/49491544.md
- de: https://zeli.app/de/story/49491544 · markdown: https://zeli.app/de/story/49491544.md
- es: https://zeli.app/es/story/49491544 · markdown: https://zeli.app/es/story/49491544.md
- ru: https://zeli.app/ru/story/49491544 · markdown: https://zeli.app/ru/story/49491544.md
