3 ms·
Current structure makes sense to me. SELECT .... what do I want FROM .... where is it WHERE .... what filters do I want to apply GROUP BY .... how do
by SoftTalker 5mo ago
Current structure makes sense to me.
SELECT .... what do I want
FROM .... where is it
WHERE .... what filters do I want to apply
GROUP BY .... how do I want it aggregated
Maybe it's just that I'm so used to it. I could see FROM being first, that would actually make a little more sense to me.
- efromvt 5mo agoA 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>
- anonymars 5mo agoAlso helps with autocomplete, which is why LINQ starts with `from`
- deepsun 5mo agoLinq 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.
- anonymars 5mo agoHibernate puts SELECT last if requesting only specific properties? LINQ: var query = from e in entities where e.property1 == value select e.property2;
- sgarland 5mo ago> I could see FROM being first, that would actually make a little more sense to me. Personally, I disagree. In English, an imperative statement like "move that chair from the dining room to the living room" is generally verb-first (with respect to location, anyway). SQL's flow has always made perfect sense to me.