I don't always write database-driven applications, but when I do, I prefer PostgreSQL. Stay ACID-ic, my friends. · Author has 1.4K answers and 10.9M answer views · 10y ·
The fact that you can't rearrange "clauses" in select statements can drive me a little bit crazy.
When I have to write a query like this...
- SELECT ft.id, bt.id, func(col3)
- FROM foo_table ft
- LEFT JOIN bar_table bt on (ft.frob=bt.baz)
- JOIN other_table ot on (bt.baz=ot.whatsit)
- WHERE ft.wee in (1,2,3)
- GROUP BY ft.id, bt.id
Usually the output columns (results) are not what I think of first. Often the tables and the join conditions are what I think about first. Sometimes the grouping or filtering is what I think about first. I'm always having to jump around and go back and edit things out-of-order when writing a query... and it gets messier when there are subqueries.
I wish I could rearrange a big query like this, for example...
- SELECT FROM foo_table ft
- LEFT JOIN bar_table bt on (ft.frob=bt.baz)
- JOIN other_table ot on (bt.baz=ot.whatsit)
- WHERE ft.wee in (1,2,3)
- OUTPUT ft.id, bt.id, func(col3)
- GROUP BY ft.id, bt.id
The SQLAlchemy ORM for Python does allow building up SQL queries in mostly-arbitrary order, which is one of my favorite features :)
1.3K views ·
View upvotes
· 1 of 5 answers
Something went wrong. Wait a moment and try again.