Re:Relational is more than SQL
by edgyquant on Saturday September 16, 2023 @06:19PM
(#37539349)
If you know <expr> then yes you know the shape of the data. You may not know the number of rows, but I fail to see how that makes it not analyzable.
[ Parent
| on HN ]
Re:Relational is more than SQL
by maximilianroos on Saturday September 16, 2023 @07:03PM
(#37539692)
Quoting from https://www.scattered-thoughts.net/writing/against-sql/:
---
There are many cases where a small change to a computation requires totally changing the structure of the query, but subqueries are my favourite because they're the most obvious way to express many queries and yet also provide so many cliffs to fall off.
-- for each manager, find their employee with the highest salary
> select
> manager.name,
> (select employee.name
> from employee
> where employee.manager = manager.name
> order by employee.salary desc
> limit 1)
> from manager;
name | name
-------+------
alice | bob
---If the inner query has more than one row, the query will raise an error. That's difficult to know from the SQL alone.