Article may be outdated

This article is 6 days old. Some details may have changed since publication.

Hacker News·6 min read·hard

A better SQL in 11 lines of code

R
remywang
AI Summary

This technical tutorial introduces Prela, a new query language developed at UCLA that utilizes binary relations to simplify data querying. The author demonstrates how to implement a toy version of the language in Python to perform complex data operations in fewer lines than standard SQL.

Why it matters

Innovations in query languages can significantly improve developer productivity and data processing efficiency in database management.

Dive DeeperCreate a free account to unlock

Prela is a new query language being developed at UCLA RePL . The language is quite different from SQL, but its key ideas are very simple. In this short tutorial, we will build a toy version of Prela in Python to understand its core principles. By the end of this tutorial, you will know how the following query works:

movie.where(company.s(country).eq( "[us]" ) & keyword.eq( "character-name-in-title" )) .select(title & cast.s(person).s(alias).s(text)) You can probably already guess what it's doing: the query finds every movie produced by an American company and has a character name in its title, and outputs the title along with the alias for each cast member. Note that the equivalent query in SQL spans over 20 lines.

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technologyscience

Get smarter about the news

Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.

Create free account

Already have an account? Sign in