Building Tetris in a SQL Query!
| Date | 2025-10-24 |
| Event | PGConf.EU 2025 |
| Speaker | Nuno Faria (INESC TEC / University of Minho) |
| Slides | Download |
Abstract
While SQL is a powerful declarative language to query and modify data, it is not designed for general programming tasks. However, since the introduction of recursive Common Table Expressions (CTEs) in SQL:1999, SQL became a Turing complete language. Informally, this means that, in theory, we can implement "any" algorithm in it.
This talk presents a complete implementation of Tetris in a single SQL query, by taking advantage of recursive Common Table Expressions and DuckDB's USING KEY feature.