Hacker News new | ask | show | jobs
by efromvt 19 days ago
A pretty common request is to lift the FROM up before the select, like the below. I'm pretty fine with status quo since my mind is usually "hmm what do I need to get" first, then I figure out how to get it, but some engines (duckdb, I think?) support both so everyone gets their cake.

What people often want: <where to get data from> <what I want from it> <how it's filtered> <how it's grouped> <how it's filtered post group>

1 comments

Also helps with autocomplete, which is why LINQ starts with `from`
Linq took that from Hibernate in believe. But in general, I'd say almost all ORM and SQL-gen libraries have FROM first, because it's clearer for programmers.
Hibernate puts SELECT last if requesting only specific properties?

LINQ:

  var query = 
    from e in entities
    where e.property1 == value
    select e.property2;