Hacker News new | past | comments | ask | show | jobs | submit login

Is there research on what is easier to read when you are sifting through many queries?

I like the syntax for reading what the statement expects to output first, even though I agree that I don’t write them select first. I feel like this might be optimizing the wrong thing.

Although the example is nice, it does not show 20 tables joined first, which will really muddle it.




The select list is meaningless without everything that follows. Knowing that a query selects "id, "date" tells you nothing without knowing the table, the search criteria, etc.


That's one benefit of the SQL naming convention which would use names like e.g. customer_id, invoice_date, etc. Also, when joining tables (depending on the SQL dialect) that can allow a shortcut synax, JOIN ON field_name, if the field name in the two tables is the same.


I really wish SQL used "RETURN" instead of "SELECT" (like in XQuery):

1. Calling it "RETURN" makes the fact of its later order of execution (relative to FROM etc) less surprising.

2. "RETURN RAND()" just reads more naturally than "SELECT RAND()". After all, we're not really "selecting" anything here, are we?

3. Would also eliminate any confusion with the selection operation in relational algebra.


If you name fields that way, but accountId, createDate may not be meaningless in the context you are looking at.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: